2019-09-26 11:12 PM
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
Solved! Go to Solution.
2019-09-27 07:16 AM
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
2019-09-27 07:16 AM
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
2019-09-29 11:22 PM
Thank you very much.
It's working now.
Regards
Dejan
2021-06-01 07:30 AM
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
2021-06-01 07:14 PM
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
2021-06-01 07:15 PM
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
2021-06-02 06:54 AM
You can put it anywhere you like, really. You can even defer registering and unregister to only receive ticks during a certain interval.
/Martin