cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX. Disable/Enable touch events from Model

MNema.1
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX

View solution in original post

1 REPLY 1
LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX