Skip to main content
KNara.2
Associate III
October 4, 2023
Question

How to display image/widget in the current active screen upon receiving an event from backend?

  • October 4, 2023
  • 1 reply
  • 820 views
How to display image/widget in the current active screen upon receiving an event from backend?
 
 
Hi,
 
Let's say we have 10 screens and we need to make a image/widget visible when an event is received from backend.
Can it be done this way?
 
In model.cpp 
whenever the event is receieved 
static_cast<FrontendApplication*>(touchgfx::Application::getInstance())->handleTickEvent();
 
and in Screen1View.cpp
void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
    displayIcon();
}
 
void Screen1View::displayIcon()
{
uint8_t status = Screen1ViewBase::presenter->GetStatus(); //Read the status received along with the event
if(status == 0x00)
{
IconImage.setVisible(true);
IconImage.invalidate();
}
}
 
void Screen1View::handleTickEvent()
{
displayIcon();
}
 
My question is - Does it create overhead in handleTickEvent of each screen to repeatedly read the status from model?

 

This topic has been closed for replies.

1 reply

Yoann KLEIN
ST Employee
October 5, 2023

Hello @KNara.2,

I think what you propose should be doable without issues, since handleTickEvent() will only be used for the active Screen.

If you need more insights about how to use the Model-View-Presenter pattern within TouchGFX, you can read the documentation. There are also many posts treating similar topics in this forum, like this one.

Yoann KLEINST Software Developer | TouchGFX