Handling Multiple Screen Transitions

User Question: How does Storyboard handle screen transition requests whilst already processing an ongoing screen transition? I thought they would be queued within the application, but only one transition occurs.


By default, when Storyboard receives a screen transition event while a screen transition is occurring, it will be ignored.

In general, this is an optimization. There aren't too many use cases where this is desired, and if it is desired it can be done manually.

So if you would like to have a screen transition queue system, the Storyboard event system provides enough hooks for you to develop this system in Lua.

For the purpose of this post, I've attached a sample project that demonstrates a screen transition queue system.



In this zip file you will find two applications, one is the actual queue system application, and the other is a simulator which sends 2 to 5 screen transitions at one time.

In the main application, there are 3 screens with a button on each screen. These buttons simply navigate to the next screen: 1>2>3>1, etc. 

In order to send multiple screen transitions at once, you can click either of the two buttons on the simulator to send the corresponding amount of transition events. You can also do this after manually navigating to a screen on the main app using the aforementioned buttons. 



All screen transition requests call into the function cb_request_screen_transition() which will insert the requested screen into a list called nav_screen_list and then call change_screen(). change_screen() will  set a global variable called screen_target to the requested screen. After that it sends a screen_navigate event, which triggers a screen transition to whatever screen_target has been set to.

At the application level, an action triggered by any gre.screenshow.post event will call the function cb_check_screen_list(). This function removes the screen we just transitioned to from the nav_screen_list and then checks the list to see if it is empty. If it is empty, we know that we’ve transitioned to all requested screens. If it is not empty, we know that there are more screens left to be transitioned to, so it will then call change_screen() again and pass it the next screen in the nav_screen_list.

By binding gre.screenshow.post to the application level, this means that any time a screen transition finishes anywhere in the application, it will call into the specified function. This is what allows us to track when transitions occur. Then simply by maintaining a list of requested screens to be transitioned to, we can easily create a looping set of logic that handles all of the transition requests.



Please find the sample project here: DOWNLOAD LINK




  • Is it possible to get the sample project?

    The link is dead. 

    Use case: If an internal application error occurs during screen transition (specifically the pre) then we want to redirect to error screen.

  • The link has been updated.




Please sign in to leave a comment.

Didn't find what you were looking for?

New post