cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a screensaver with TouchGFX?

VSimu.1
Associate III

Could you please provide some advice or example code on how best to create a screensaver using TouchGFX?

I am looking for the classic screensaver functionality: if someone touched the display with their finger whatsoever, then the screensaver counter should reset.

When the counter reaches a threshold, then there is a transition to some kind of "screensaver screen". This could even be a Modal Box. After touching the device again, increase again the screen brightness and enter some password if necessary, to go back to the screen where the user was at previously.

I have not found a way to insert some kind of callback function into some kind of "has the screen been touched?" function. Where can I find this "has the screen been touched?" function in the TouchGFX stack, and how can I add some user level code to this?

Would appreciate any answers or tips.

Cheers!

1 ACCEPTED SOLUTION

Accepted Solutions
VSimu.1
Associate III

For anyone reading this later trying to do something like this. Peter's answer won't work because that flex button "absorbs" all of the events and you cannot click on anything. Use this instead, this will give you the "has the screen been touched?" event which you can use to reset any kind of counters you have before transitioning to some Screensaver screen you may have.

void xxxView::handleClickEvent(const ClickEvent& evt)
{
	// xxxx Your user code
 
	// Execute default behavior
	Screen::handleClickEvent(evt);
 
       // xxxx Your user code
}

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

Your idea of a "has the screen been touched?" can easily be realized by adding a flex button covering the whole screen and setting its alpha value to 0, so it appears translucent/invisible. Then add an interaction to that button and do whatever you want.

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
VSimu.1
Associate III

Thank you Peter, will try that right now. Definitely simpler than anything I was thinking, thank you for your feedback!

VSimu.1
Associate III

For anyone reading this later trying to do something like this. Peter's answer won't work because that flex button "absorbs" all of the events and you cannot click on anything. Use this instead, this will give you the "has the screen been touched?" event which you can use to reset any kind of counters you have before transitioning to some Screensaver screen you may have.

void xxxView::handleClickEvent(const ClickEvent& evt)
{
	// xxxx Your user code
 
	// Execute default behavior
	Screen::handleClickEvent(evt);
 
       // xxxx Your user code
}