How to create an exit dialog box that pops up when back button is clicked
How to create an exit dialog box that pops up when back button is clicked instead of back button exiting channel
' Channel entry point
' The roSGScreen object is a SceneGraph canvas that displays the contents of a Scene node instance
' message port is the place where events are sent
' sets the message port which will be used for events from the screen
' every screen object must have a Scene node, or a node that derives from the Scene node
screen.Show() ' Init method in MainScene.brs is invoked
' event loop
' waiting for events from screen
if msg.IsScreenClosed() thenreturn
This is my main.brs code how to stop back button from exiting the channel, how to make back button pop up a box that asks user if they want to exit the channel, how to exit channel when exit now button is clicked on box.
Re: How to create an exit dialog box that pops up when back button is clicked
Hi! Usually, you have a screen stack, where you can check whether the current view is the last in the stack or not. With this, you can achieve this functionality. You can use some flag for the initial screen e.g: "firstView" or smth like that, and then observe the screen stack for change. If the current view has this flag (or a similar one), and back btn has been pressed - show dialog.