cancel
Showing results for 
Search instead for 
Did you mean: 

handleTickEvent not working with container

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

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

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

View solution in original post

6 REPLIES 6
Martin KJELDSEN
Chief III

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

Thank you very much.

It's working now.

Regards

Dejan

JEma.1
Associate

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

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

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

You can put it anywhere you like, really. You can even defer registering and unregister to only receive ticks during a certain interval.

/Martin