shutDownRequest being called twice

Robert Brenstein rjb at rz.uni-potsdam.de
Sun Jan 25 12:30:06 EST 2004


>I am seeing my "are you sure you want to shut down" twice (the
>shutDownRequest handler) prompt twice now.
>
>I think the reason for this is that I added an
>
>insert script for stack "mainstack" into back
>
>so I could make use of the mainstack handlers in all the stacks.
>
>But the shutDownRequest handler looks like this:
>
>on shutDownRequest
>   answer "Are you sure you want to quit?" with "No" or "Yes"
>   if it is "Yes" then
>     pass shutDownRequest
>   end if
>end shutDownRequest
>
>I need to "pass shutDownRequest". I think the "pass shutDownRequest" is
>passing it "up" the path and it is re-encountering itself in the
>backScripts.
>
>Any ideas of how to avoid this problem?
>
>Thanks,
>
>doug
>

You can use the control variable to avoid double run as others 
suggested, but I would re-examine the approach. There is no 
requirement that handlers you put in the backscript are the stack 
script. I'd would stick all those needed there into an invisible 
button and leave as stack scripts only those that really need to be 
there. You then insert the script of that button into back.

The shutdownrequest would go either into the backscripts button (if 
you want it to be invoked regardless which stack got it) or into 
stack script (if you want to trap it in that one stack only). In 
either case, you will have only a single instance.

Robert


More information about the use-livecode mailing list