'Quit' mystery

Martin Koob mkoob at rogers.com
Tue Nov 26 13:19:54 EST 2013


Hi

It has been a long time since I set this up in my application so I don't
remember exactly the logic as to why I set this up this way but it seems to
work.  The main stack has several substacks which may be open when quit is
selected from the menu.

Each of the substacks' scripts have a shutdownRequest handler but not a
'pass shutdownRequest' command.  This handler sends a prepareToQuit command
to the main card of the main stack.

substack stack script
-------------------
on shutdownRequest
   send "preparetoquit" to card "main" of stack "mainstack"
end shutdownRequest
------------------
The main card of the main stack has the prepareToQuit handler which just has
a quit command.  This triggers the shutdownRequest handler in the main card.  
This shutdownRequest handler has all of the code you want implemented before
quitting.  This handler has the 'pass shutdownRequest' command that allows
the application to quit.

Mainstack >card "main" script
-----------------------
on preparetoquit
    quit
end preparetoquit

on shutdownRequest
    <do stuff here>

    pass shutdownRequest
end shutdownRequest




--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Quit-mystery-tp4672924p4672933.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list