Problems with ShutDownRequest
rjb at robelko.com
Tue May 24 15:42:21 CDT 2005
>One of my apps is not processing ShutDownRequest properly, but it's
>very complex, so I decided to build a simple test stack. I'm seeing
>the same thing with it. All my testing is done after building a
>standalone from the stack.
>I start out with a main stack. The main stack has this handler:
> answer "Really, Really Quit?" with "No" or "Quit"
> if it is "Quit" then pass ShutDownRequest
>If I run the main stack and choose Quit, I get the answer dialog and
>everything works as expected.
>Now, I've put a button on the main stack that creates a new stack and
>places this handler in its stack script:
> send "ShutDownRequest" to stack "Quit Test" -- my main stack
>If I click this button, thus creating the new stack, and then choose
>Quit, I again get the answer dialog and everything works fine. If that
>stack is frontmost, it sends the ShutDownRequest to my other stack
>which puts up the dialog.
>Here's the problem. If I close the second stack (the one created by
>the button) and then create a another one (by clicking the button
>again), THIS TIME, if I select Quit, the standalone quits, closing
>both stacks without giving me the answer dialog.
>For some reason, creating a stack, closing it, and creating a new one
>causes the Rev engine to bypass the ShutDownRequest handlers
>If I can't trap shutDownRequest, my clients will lose all their data
>if they choose Quit without saving their document.
>What am I missing?
I bet that if you copy the shutdownrequest script from your main
stack to the one created on the fly (and thus do not send), the
problem will go away. Shutdownrequest seems to be context specific
and I think that your sending it from one stack to another confuses
More information about the use-livecode