Scope issues

Hi guys,
I was wanting to write a custom library to create a menu on an LCD using the TFT library.

My intention is to create a class, and pass the TFT object to it.

Sorry, my c is really rusty.
First problem, I find I cannot define an empty TFT TFTscreen object, I can only instantiate it.
So I decide to use pointers.

I create a header file like this

#ifndef tft_menu_lib_h
#define tft_menu_lib_h

#define cs   10
#define dc   9
#define rst  8

#include <TFT.h>


typedef struct 
{
  int Length;
  char * Items[12];
} tftMenuItems;
 

class TFTMenu
{
  TFT *TFTScreen; 
  public:
    TFTMenu(TFT *_TFTscreen);
    String PrintText(String text, String oldText, int chrLength, int x, int y, int r, int g, int b);
    void drawMenu(tftMenuItems Menu);

     
};

#endif

and this is my cpp

#include "Arduino.h"
#include "tft_menu_lib.h"


TFTMenu::TFTMenu(TFT *_TFTscreen)
{
  TFTScreen = _TFTscreen;
}

void TFTMenu::drawMenu(tftMenuItems Menu)
{
  TFTscreen->setTextSize(2);
  
  for (int i=0; i<Menu.Length; i++)
  {
    TFTscreen->text(Menu.Items[i], 0, 20 * i);
  }
}

Now the constructor compiles fine, assigning the pointer.
what doesn’t work, is drawMenu.

I get the following error

Arduino: 1.5.8 (Windows 7), Board: "Arduino Uno"

tft_menu_lib.cpp: In member function 'void TFTMenu::drawMenu(tftMenuItems)':
tft_menu_lib.cpp:12:3: error: 'TFTscreen' was not declared in this scope
   TFTscreen->setTextSize(2);
   ^
Error compiling.

please help, I’m at a loss as to why this doesn’t work, I’ve tried every logical variant I can think of, I don’t get how the blessed variable is not in scope to a member function of the class in which it is defined.

Make your mind up TFT*screen OR TFTS*creen :)

Excuse me if I type erratically whilst banging my head upon the desk.

2 hours and it's a blessed case issue!

Thanks for your help, and for being kind.

I can confirm, it compiles and runs as expected. thanks again for your help. I now consider this thread closed.

kudapucat: Thanks for your help, and for being kind.

No probs, we've all been there.