cancel
Showing results for 
Search instead for 
Did you mean: 

Instance-agnostic APIs for screen transitions

Jesper Ronnholm
Associate III

I'm attempting to find a good way of providing a simple piece of inline code that can be executed to switch screen based on a third-party variable. The idea is to have one single event to trigger a screen switch, but letting the variable determine which.

Since I am doing this before design-time (i.e. before I let someone else open the designer and create/design the actual screens) I can't know what the specific screens will be. My idea was to use the appSwitchScreen(uint8_t screenId) method in the application-class, but I understand it is just an empty virtual function that you have to implement yourself.

It would be very convenient to be able to represent every screen switch by a simple integer value, but is this possible in the way I explained above? Is there an array of screen instances somewhere in the touchgfx API that is easily accessible?

1 REPLY 1
Martin KJELDSEN
Chief III

Hi @Jesper Rönnholm​,

We do not generate an array/enum with the "names" of each screen. What we sometimes do in applications is to have a base presenter with a custom goto() like method that knows about your screen definitions through an enumeration that you define.

Best regards,

Martin