cancel
Showing results for 
Search instead for 
Did you mean: 

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

KNara.2
Associate III
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?

 

1 REPLY 1
Yoann KLEIN
ST Employee

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 KLEIN
ST Software Developer | TouchGFX