cancel
Showing results for 
Search instead for 
Did you mean: 

I would switch to a particular screen when an external event occurs. Andy idea?

Mvill.17
Associate III

A typical situation is when the hardware detects a fault condition. In this case I would switch to a page where I can display​ an alarm icon and a short description of the fault

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi Marco,

Currently, you'll need to have some transition defined in your designer (for the particular screen) in order for the generator to create the transition method.

If that transition method is generated, you can switch screens like this:

static_cast<FrontendApplication*>(Application::getInstance())->gotoErrorScreen();

Your Error Presenter can then get the error data from the model and initialize the view.

EDIT: You can actually create an interaction without a trigger and still get the method generated (By default you do not have all the methods to transition between screens because you need to specify HOW you want to transition - No transition, slide- or cover transition). It's something that will be improved for the next version.

/Martin

View solution in original post

5 REPLIES 5
Martin KJELDSEN
Chief III

Hi Marco,

Currently, you'll need to have some transition defined in your designer (for the particular screen) in order for the generator to create the transition method.

If that transition method is generated, you can switch screens like this:

static_cast<FrontendApplication*>(Application::getInstance())->gotoErrorScreen();

Your Error Presenter can then get the error data from the model and initialize the view.

EDIT: You can actually create an interaction without a trigger and still get the method generated (By default you do not have all the methods to transition between screens because you need to specify HOW you want to transition - No transition, slide- or cover transition). It's something that will be improved for the next version.

/Martin

Mvill.17
Associate III

Thanks Martin. It's just what I did. I created an hidden button generating a transition and then called that method to switch to the desidered screen. I just wandered if there's a smarter way to do it considering the possibility to switch to that screen from everywhere and not just from one particular screen

Martin KJELDSEN
Chief III

Yes, the old "hidden button" trick. You can actually create an interaction without a trigger and still get the method generated. It's something that will be improved for the next version.

It doesn't mean you can only use it from one particular screen. You can use it anywhere (like the model when you receive your hardware fault).

/Martin

mattstein
Associate II

Hi there,

does TouchGFX support multiple presenters available at a time? E.g. one to handle normal data for the view and another one to handle the error event, timeouts, ...? Otherwise where do you put the transition call if you have multiple screens and regardless what screen is active, there shall be general event handling always active to e.g. transition to the error view?

So the destination and mechanism to the alarm screen is clear to me, but the source where to handle the event is not.

Thanks for the clarification

Martin KJELDSEN
Chief III

Hi @mattstein​,

Back from vacation. No, only one view/presenter pair is available at any point in time. We were considering at one point experimenting with having multiple pairs available using two LTDC layers, but we haven't done anything about it ... yet. But you would only do this if you wanted to render two frames to RAM at the same time. Generally this is not related to events.

If you wanted to handle events generally, do so in your Model::tick() and change to the desired screen accordingly.

/Martin