TFT Touchscreen button problem

need some help i want to disable other buttons when entering one button page for e.g 1)" when i click on blue button and entered blue page i want to disable yellow and green page as shown in video" for e.g 2) if click on yellow button and entered yellow page i want to disable blue page and green page.

TFT.ino (8.62 KB)

media.io_TFTvideo(1).zip (1.52 MB)

Is anyone here ?

Hello

Did you find a solution for that problen?
I'm running in the same issue with no results.

Please let me know.
Thank you.

So, what you say is that the “blue”, “yellow” and “green” button should only be active in “homepage”?

If so, set a flag when entering homepage:

bool homepageActive;

void homepage()
{
    homepageActive = true;               //Homepage entered
    button = false;
    pinMode(XM, OUTPUT);
    :
    :

Then, only check the colour-buttons when “homepageActive == true”:

  if (homepageActive) {                             //Homepage active?
    
    if (p.y > 189 && p.y < 215 && button) {
      // do stuff if the condition is true
      if (p.x > 134 && p.x < 156 && button)
      {

        blue();

        ///////////////////////////////////////////

      }
    }


    else if (p.y > 116 && p.y < 140 && button) {     //No need for checking 'yellow' if 'blue' already pressed
      // do stuff if the condition is true
      if (p.x > 72 && p.x < 104 && button)
      {

        yellow();

        ///////////////////////////////////////////////////////////////////////////////

      }
    }


    else if (p.y > 37 && p.y < 58 && button) {
      // do stuff if the condition is true
      if (p.x > 14 && p.x < 35 && button)
      {

        green();

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

      }
    }
  }

(Also consider if test for homebutton is needed if already on homepage…)

When entering the subpages, set “homepageActive = false”:

void blue()
{
  homepageActive = false;
  button = false;
  :
  :
}