Skip to main content
HTD
Senior II
June 8, 2022
Question

TouchGFX: How to change the screen to a specific one from the Model?

  • June 8, 2022
  • 1 reply
  • 998 views

The action should be triggered from a hardware driver and work from any screen.

What I already know:

How to generate "goto" functions from TouchGFX designer and call them from a view.

Now - the hard way to do that is to generate the "goto" functions for each view and bind them from presenters to the ModelListener event. A lot of clicking and writing, the more of it the more screens I have in my application, and I have plenty of them.

My goal is to make it simpler, but I don't know is there a simpler way. The idea is whenever a hardware driver error occurs - I want my application to immediately show a kind of BSOD to ensure when the screens show data - the data is accurate (because otherwise BSOD should appear).

This topic has been closed for replies.

1 reply

HTD
HTDAuthor
Senior II
June 8, 2022

OK, so I got a pretty nice workaround:

I put my BSOD function in my ModelListener.hpp:

// ...
 
#include <gui/common/FrontendApplication.hpp>
 
// ...
 
void BSOD()
{
 static_cast<FrontendApplication*>(touchgfx::Application::getInstance())
 ->gotoErrorScreenNoTransition();
}

And that's it. Probably the quickest way to do it.