Problem with simple version of TouchScreenMenu library, screen is not redrawing

Hi,
I am using Arduino 1.0.6 IDE and creating simple version of menu inspired by TouchScreenLibrary project. I attach all libraries from my IDE, the project name is: TouchScreenMenuTestCUSTOM10
To check my program you would need touchable LCD screen or if you are good at programming, maybe the code would work.
Pin settings are in TouchScreenMenu.cpp and TouchScreenMenu.h in TouchScreenMenu folder.
I am using Arduino Uno and 2,4’’ LCD touchscreen, the Adafruit_TFTLCD library supports this chips: if(identifier == 0x9325) {// also 0x9328, 0x7575, 0x0154

My is if(identifier == 0x0154) {
Serial.println(F(“Found S6D0154 LCD driver”));

In serial monitor you would see some information logged:

clearing..
TouchScreenMenu::draw:=Menu
TouchScreenMenu::drawItem2=MENU_A
TouchScreenMenu::drawItem2=MENU_B
TouchScreenMenu::drawItem2=MENU_C
p.x26
p.y70
tx=26
ty=70
ty<=y+h-1=1
CheckingItem: MENU_A
x=0
y=46
tx>=x && tx<=1201
ty>=y && ty<=y+h-11
MENU_A
,
119***
TouchScreenMenu::drawItem1=MENU_A
NotNullItem:=MENU_A
clearing..
MENU_A!!
clearing..
TouchScreenMenu::draw:=Sub Menu
TouchScreenMenu::drawItem2=<- Main Menu
TouchScreenMenu::drawItem2=Left Justify
TouchScreenMenu::drawItem2=Right Justify
TouchScreenMenu::drawItem2=Small Font

Logs say that after I touched MENU_A option, Submenu is being draw but I still see the main menu.

If I just write this code in loop it redraws menu in loop and I see changes on the screen:

//THE BELOW CODE WORKS!!!! IT REPAINTS MY SCREEN
   /* curMenu = &subMenu;
        TSC.clearScreen();
         Serial.println("Why this works and why checkMenuSelection doesnt repaint my screen?");
        curMenu->draw();

The same is done by the checkMenuSelection function, but nothing changes on the screen (logs are the same)

// check to see if any menu item was pressed and do something
 void checkMenuSelection(TouchScreenMenuItem *item) {
  boolean handled = false;
  if(item != NULL){
    
      Serial.print("NotNullItem:="); Serial.println(  item->getText() );
    // main menu items 
    if(curMenu == &mainMenu){
      if(!strcmp(item->getText(),"MENU_A")){
        curMenu = &subMenu;
        TSC.clearScreen();
         Serial.println("MENU_A!!");
        curMenu->draw();
        handled = true;
      }
       
    }
    
    // if the menu item didn't get handled redraw it unpressed
    if(handled==false)
      curMenu->drawItem(item,false);
  } 
 
 }

Whole code of the INO project withoug libraries:

#include <Adafruit_GFX.h> 


#include <Adafruit_TFTLCD.h>

#include <TouchScreen.h>
#include <TouchScreenMenu.h>
#include <cstddef.h>
#include <MemoryFree.h>
 
// create the array of items for the first sub menu
TouchScreenMenuItem subMenuItems[] = {
  TouchScreenMenuItem("<- Main Menu",""),
  TouchScreenMenuItem("Left Justify",""),
   TouchScreenMenuItem("Right Justify",""),
  TouchScreenMenuItem("Small Font","") ,
 /* TouchScreenMenuItem("Spacing"),
  TouchScreenMenuItem("Padding"),*/
  TouchScreenMenuItem("ENDOFMENU")
};

 

// create the array of items for the main menu
TouchScreenMenuItem mainMenuItems[] = {
  TouchScreenMenuItem("MENU_A", "MENU_A"),
 /* TouchScreenMenuItem("Gfx Functions"),
  TouchScreenMenuItem("Buttons"),*/
  TouchScreenMenuItem("MENU_B", "MENU_B"),
  TouchScreenMenuItem("MENU_C", "MENU_C"),
  TouchScreenMenuItem("ENDOFMENU")
};

 
TouchScreenMenu subMenu ;
TouchScreenMenu mainMenu ;

 
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
 
 TouchScreenMenu *curMenu;
    
void setup(void) {
    Serial.begin(9600);
 
   TSC.setBackColor(TSC.createColor(255, 255, 0)); // change the default background color
 
   TSC.init(); // make sure everything get initialized
 
 // create the various menus setting the items, font size, spacing, padding, justification and titles
     subMenu = TouchScreenMenu(subMenuItems, 2, 10, 5, CENTERJ, "Sub Menu");
  mainMenu = TouchScreenMenu(mainMenuItems, 2, 10, 10, CENTERJ, "Menu");

// keep track of which menu is the currently active one
   curMenu = &mainMenu;
   curMenu->draw(); // put up the main menu
  
}

void loop(void) {
 
 ////   Serial.println(getFreeMemory());
 
   if(curMenu!=NULL){
      
    TouchScreenMenuItem *item = curMenu->process(false);
 //THE BELOW CODE DOESNT WORK, IT LOGS THAT IT IS REPAINTING TH SCREEN, BUT I SEE STILL THE MAIN MENU 
    checkMenuSelection(item);
  }else{
    
   // checkButtons();
  }
  
 //THE BELOW CODE WORKS I UNCOMMENTED AND THE ABOVE CODE IS COMMENTED. IT REPAINTS MY SCREEN
   /* curMenu = &subMenu;
        TSC.clearScreen();
         Serial.println("ZEGAR!!");
        curMenu->draw();
    */ 
}
 

// check to see if any menu item was pressed and do something
 void checkMenuSelection(TouchScreenMenuItem *item) {
  boolean handled = false;
  if(item != NULL){
    
      Serial.print("NotNullItem:="); Serial.println(  item->getText() );
    // main menu items 
    if(curMenu == &mainMenu){
      if(!strcmp(item->getText(),"MENU_A")){
        curMenu = &subMenu;
        TSC.clearScreen();
         Serial.println("MENU_A!!");
 //THE BELOW CODE DOESNT WORK!!!! IT LOGS THAT IT IS REPAINTING TH SCREEN, BUT I SEE STILL THE MAIN MENU 
        curMenu->draw();
        handled = true;
      }
       
    }
    
    // if the menu item didn't get handled redraw it unpressed
    if(handled==false)
      curMenu->drawItem(item,false);
  } 
 
 }
[code]

libraries.zip (695 KB)