Page 1 of 1

Prompting before "on closeStack"

Posted: Thu Sep 14, 2017 8:44 am
by Googie85
Hi Guys,

I am having some difficulties trying to prompt a user before the app closes when the back button is pressed on a device. The example is as follows:

on closeStack
global timer
put "2" into timer
send "mouseDown" to image "StartButton"
pass closeStack
end closeStack

No matter what I do, the App continues to exit after the back button is pressed.

Any help will be appreciated.

Many Thanks,

Googie.

Re: Prompting before "on closeStack"

Posted: Thu Sep 14, 2017 9:45 am
by Thierry
Googie85 wrote: No matter what I do, the App continues to exit after the back button is pressed.
Hi,

You can check in the dictionary: closeStackRequest

Handle the closeStackRequest message if you want to prevent a stack from being closed.


HTH,

Thierry

Re: Prompting before "on closeStack"

Posted: Thu Sep 14, 2017 9:52 am
by Klaus
Hi Googie,

and there is really no need to put NUMBERS into quotes! :D


Best

Klaus

Re: Prompting before "on closeStack"

Posted: Thu Sep 14, 2017 4:36 pm
by jacque
You need to trap the backKey message. Android OS will quit the app if you don't handle backKey, so you need to handle it on every card. Use it to navigate within the stack the same way any navigation arrows do (if the card has those) or just don't pass the message if you don't want backKey to do anything (but users will hate you if you disable it.)

You can use the same handler you're using now for closeStack and just change the message name to backKey.