Skip to main content
MNema.1
Associate II
March 21, 2024
Solved

TouchGFX. Disable/Enable touch events from Model

  • March 21, 2024
  • 1 reply
  • 1424 views

Hello!
I need to be able to enable and disable touch screen from my GUI application. 
I don't want to cut the power to the touchscreen.
I want my handle click functions on multiple screens to not to respond to touch events for some time after certain point of time or another event. So I imagine a function in Model class that would somehow enable and disable touch events. How can I achieve that the best way?
I guess it is not a good idea to have a flag in touchController (if the flag is set, return false from sampleTouch...)

Thank you.

This topic has been closed for replies.
Best answer by LouisB

Hello @MNema.1 ,

A simple way to do so is to use an invisible flex button that will cover the whole screen, on top of everything.
You can activate or deactivate it when you need it, if you want it to last x ticks, then you can combine the flex button with HandleTick and a timer.

 

...
void myFucntion(){
	//do action
	myInvisibleFlexButton.setVisible(True);
}
...
ScreenX::handleTickEvent(){
	if(timerActive && (count<timerCount)){
		count++;
	}
	else if (count>timerActive){
		timerActive=false;
		myInvisibleFlexButton.setVisible(False);
	}
}
...

 

 

You can create button in the model and each time you go to a screen you add it at the setup.

I hope it helps you,

Regards,

1 reply

LouisBBest answer
ST Employee
March 22, 2024

Hello @MNema.1 ,

A simple way to do so is to use an invisible flex button that will cover the whole screen, on top of everything.
You can activate or deactivate it when you need it, if you want it to last x ticks, then you can combine the flex button with HandleTick and a timer.

 

...
void myFucntion(){
	//do action
	myInvisibleFlexButton.setVisible(True);
}
...
ScreenX::handleTickEvent(){
	if(timerActive && (count<timerCount)){
		count++;
	}
	else if (count>timerActive){
		timerActive=false;
		myInvisibleFlexButton.setVisible(False);
	}
}
...

 

 

You can create button in the model and each time you go to a screen you add it at the setup.

I hope it helps you,

Regards,