Skip to main content
Dejan Nedeljkovic
Associate III
September 27, 2019
Solved

handleTickEvent not working with container

  • September 27, 2019
  • 4 replies
  • 3499 views

Hi

I've declared virtual void handleTickEvent() in the header file of my container.

In my cpp file of the container I would like to update my battery bar on every tick:

void BatteryBar::handleTickEvent()
{
 if(tickCounter >= 100)
 {
 tickCounter = 0;
 }
 UpdateBatteryBar(tickCounter++);
}

I'm not getting it to run. It never enters to handleTickEvent().

What else do I have to do to enable the tick event?

Regards

Dejan

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Hi @Dejan Nedeljkovic​,

Only some components in TouchGFX (Like a View) are automatically subscribed to tick events. For containers, you must call this from your widget =)

Application::getInstance()->registerTimerWidget(this);

/Martin

4 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
September 27, 2019

Hi @Dejan Nedeljkovic​,

Only some components in TouchGFX (Like a View) are automatically subscribed to tick events. For containers, you must call this from your widget =)

Application::getInstance()->registerTimerWidget(this);

/Martin

Dejan Nedeljkovic
Associate III
September 30, 2019

Thank you very much.

It's working now.

Regards

Dejan

JEma.1
Visitor II
June 1, 2021

Hello,

Can you specify where to put that line exactly? I am trying to update a graph shown in a screen that is part of a custom container and I can't find a proper way to do it. where do I write the function that updates the graph for every tick event?

Related to the question above, is there any way to change a custom container (for example change an image) from an event happened in a certain screen? I can modify any widget in a screen as lon as they are single widgets but not custom containers.

thanks in advance

BParh.1
Senior III
June 2, 2021

Hi this might be useful, similar to my thread

https://community.st.com/s/question/0D53W00000q4mS2SAI/how-to-detect-long-press-on-custom-container

I attached the code sample there as well for your reference

BParh.1
Senior III
June 2, 2021

Anyway, in my thread, it seems there is issue with this registering and unregistering the handleTickEvent()

https://community.st.com/s/question/0D53W00000q4mS2SAI/how-to-detect-long-press-on-custom-container

The issue only happen at initial time