Skip to main content
VSimu.1
Associate III
September 4, 2020
Solved

How to make a screensaver with TouchGFX?

  • September 4, 2020
  • 3 replies
  • 1178 views

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!

This topic has been closed for replies.
Best answer by VSimu.1

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
}

3 replies

Peter BENSCH
Technical Moderator
September 4, 2020

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
VSimu.1Author
Associate III
September 4, 2020

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

VSimu.1
VSimu.1AuthorBest answer
Associate III
September 4, 2020

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
}