Touch screen LCD button problems

I am trying to write a program for a touchscreen LCD and I wanted to have buttons similar to the UTouch button program layout and I have gotten the calibration and button setup the way I want but something is wrong with my code and I can’t get the buttons to react the way that I want. The first button is supposed to say “Sensor 1 On” and when clicked “Sensor 1 Off” and button two would say “Sensor 2 On” and when clicked “Sensor 2 Off” but If sensor one button is pressed it’s supposed to stay clicked down and change color and name until clicked again to turn it off. But when I click sensor one the other button changes color and name as well and if I click that button it changes the buttons back to the original display. I just want for only the buttons clicked to change color and name not all. Please if anyone can help I will be grateful. Oh and I am new to coding so forgive the sloppiness.

#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
extern uint8_t nadianne[];
extern uint8_t franklingothic_normal[];
extern uint8_t various_symbols[];


UTFT          myGLCD(ITDB32S,38,39,40,41);


UTouch        myTouch(6,5,4,3,2);

UTFT_Buttons  myButtons(&myGLCD, &myTouch);

void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(nadianne);

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
  
  myButtons.setTextFont(franklingothic_normal);

}

void loop()
{
  int but1, but2, but3, but4, but5, but6, pressed_button,pressed_button2;
  boolean default_colors = true;
  
  but1 = myButtons.addButton( 10,  20, 300,  20,"Sensor 1 On" );
  but2 = myButtons.addButton( 10,  60, 300,  20, "Sensor 2 On");
   myButtons.drawButtons();
  
  
  while(true) 
    {
      if (myTouch.dataAvailable() == true)
    {
      pressed_button = myButtons.checkButtons();

      if (pressed_button==but1)
      {
        if (myButtons.buttonEnabled(but1))
          myButtons.enableButton(but1, true);
      }
      
        if (pressed_button==but1) 
     {
          myButtons.setButtonColors(VGA_WHITE, VGA_WHITE, VGA_WHITE, VGA_WHITE, VGA_BLUE);
          myButtons.relabelButton(but1, "Sensor 1 On");
          myButtons.drawButtons();
          default_colors=true;
        }
        else
        {
          myButtons.setButtonColors(VGA_BLACK, VGA_WHITE, VGA_WHITE, VGA_WHITE, VGA_RED);
          myButtons.relabelButton(but1, "Sensor 1 Off");
          myButtons.drawButtons();
          default_colors=true;
      }
      
         if (myTouch.dataAvailable() == true)
    {
      pressed_button = myButtons.checkButtons();
    
  
     if (pressed_button==but2)
      {
        if (myButtons.buttonEnabled(but2))
          myButtons.enableButton(but2, true);
      }
      
       if (pressed_button==but2)
      {
        if (default_colors)
        {
          myButtons.setButtonColors(VGA_WHITE, VGA_WHITE, VGA_WHITE, VGA_WHITE, VGA_BLUE);
          myButtons.relabelButton(but2, "Sensor 2 On");
          myButtons.drawButtons();
          default_colors=false;    
        }
        else
        {
          myButtons.setButtonColors(VGA_BLACK, VGA_WHITE, VGA_WHITE, VGA_WHITE, VGA_RED);
          myButtons.relabelButton(but2, "Sensor 2 Off");
          myButtons.drawButtons();
          default_colors=true;
        }
      }
    }
      
    }
  }
}

Do your button drawing in setup(), not loop(). Get rid of the stupid endless loop in the endless loop().

      if (pressed_button==but1)
      {
        if (myButtons.buttonEnabled(but1))
          myButtons.enableButton(but1, true);
      }
      
        if (pressed_button==but1) 
     {

Is there some reason to have to separate blocks with exactly the same conditional? No, there isn't.

If the button is enabled, enable it. Am I missing something?

You need to use Tools + Auto Format to fix your horrid indenting. You have some code inside blocks, where the nesting is wrong.

I am new to coding and have never done this before thanks for the help, I am just starting to learn this stuff and don't mean to make so many mistakes that is why I came to this forum to get help and learn from my mistakes.

If anyone else could help I will appreciate the advice. I am having the same problem, the button when clicked stays at the sensor 1 off and the other button just flickers. All I want is for the buttons to turn on and off the sensors when clicked.

If anyone else could help I will appreciate the advice.

Are you going to ignore it, like you did mine?

no I did what you said and made some other corrections to the code that I didn't realize were there and now it works . Thanks again and plus I didn't even know there was an auto format. Now I need to figure out how to send the commands via bluetooth from this arduino to another to perform the actions.