Skip to main content
MauFanGilaMedical
Associate III
December 3, 2025
Solved

Detect any touch

  • December 3, 2025
  • 3 replies
  • 145 views

Hello,

I developed a product,

but customer wants that if no touch detected in 10 seconds the device will go in home page.

 

I believe that the only way is to manage STM32TouchController.cpp in the point I have higlighted

 

MauFanGilaMedical_0-1764747915219.png

 

Is it the best way ?

Thankyou for your patience.

Best answer by JohanAstrup

The execution rate of handleTickEvent() is actually determined by how you tick the application. TouchGFX is designed to operate at 60 Hz by default, which is why I assumed 60 Hz in the code snippet.

You are correct that the generation of the screen transition code needs to be triggered, e.g. as shown in your screenshot.

You can use getCurrentScreen(), which returns a pointer to the currently displayed screen: https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_application#getcurrentscreen.
Another option is to manually save the current screen in the model, e.g. every time a screen constructor is entered.

Best regards,
Johan

3 replies

ST Employee
December 4, 2025

Hello @MauFanGilaMedical.

I believe a better solution would be to implement it in FrontendApplication. E.g. by doing something like this:

void FrontendApplication::handleTickEvent()
{
 model.tick();
 FrontendApplicationBase::handleTickEvent();

 idleTickCounter++;

 if (idleTickCounter == 10 * 60)
 {
 gotoHomeScreenNoTransition();
 }
}

void FrontendApplication::handleClickEvent(const ClickEvent& evt)
{
 FrontendApplicationBase::handleClickEvent(evt);

 idleTickCounter = 0;
}


Best regards,
Johan

MauFanGilaMedical
Associate III
December 10, 2025

OK: but I deduce that

handleTickEvent

is executed at 60fps.

 

But to have

gotoHomeScreenNoTransition();

I have to add interaction like in the picture below, right ?

MauFanGilaMedical_1-1765353423517.png

 

And there is a way to deduce what is the current display screen ? Because I have to go Home if I am in screens different from Home, Power on and Power off

JohanAstrupBest answer
ST Employee
December 11, 2025

The execution rate of handleTickEvent() is actually determined by how you tick the application. TouchGFX is designed to operate at 60 Hz by default, which is why I assumed 60 Hz in the code snippet.

You are correct that the generation of the screen transition code needs to be triggered, e.g. as shown in your screenshot.

You can use getCurrentScreen(), which returns a pointer to the currently displayed screen: https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_application#getcurrentscreen.
Another option is to manually save the current screen in the model, e.g. every time a screen constructor is entered.

Best regards,
Johan