preOpenstack cleaning

Mark Mitchell mark_mitchell at
Wed Feb 6 08:53:01 EST 2002

>>use-revolution at writes:
>I want to (i) trigger the handler when the user first starts a 
>particular stack, (ii) not have it operate when that stack is 
>returned to from a different stack in a session, and (iii) only have 
>it operate on the appropriate stack. These sound easy, but I can't 
>see  a way to do it without conditionals testing the name of the 
>stack and a global holding information regarding whether the clean-up 
has been run already. Surely it is easier than that!

I would set a custom property of the stack and then set it back on closeStack (or shutdown...
depending on how you want it to function)
On preOpenstack
if the CustomProperties of me is "dirty" then
do the cleaning stuff
set the customProperties of me to "clean"
end if
end preOpenStack

on closeStack
--or shutdown
if the customProperties of me is "clean" then
set the customProperties of me to "dirty"
end closeStack

I've done similar things like this before. Hope it works for you..
mark in Japan

More information about the use-livecode mailing list