UTouch.h button detection [SOLVED]

I am working on a project with touch LCD screen using the UTouch.h library.

Basically I am trying to detect a button, but I cant use a while statement because I need my program to run in the background without refreshing the screen.

So I am trying to do something like:

if(myTouch.dataAvailable() == true) {
myTouch.read();
x=myTouch.getX();
y=myTouch.getY();

if(x >= 250 && x <= 293 && y >= 99 && y <= 119)
{
if(button1State == false) button1State = true;
if(button1State == true) button1State = false;
}
}

Its not working though. Any tips?

I was able to figure this one out on my own. The proper syntax for button detection is this.

//Button Detection
if (myTouch.dataAvailable())
{
myTouch.read();
x=myTouch.getX();
y=myTouch.getY();
if (((y>=99) && (y<=119)) && ((x>=250) && (x<=293)))
{
if(button1State == false) {
button1State = true;
delay(50); //delay for screen debounce
} else {
button1State = false;
delay(50); //delay for screen debounce
}
}
}