Cannot exit to top in modal

Martin Baxter mb.userev at harbourhosting.co.uk
Tue May 29 04:20:04 EDT 2007


Michael Binder wrote:
> Hi everyone,
> Would some kind soul explain what I am doing wrong?
> 
> I have a mainstack "myApp" and a substack "myModals".
> 
> The mainstack has a button:
> 
> on mouseup
>   open stack "myModals" as modal
>   doSomeThings -- unless the user cancels the modal
> end mouseup
> 
> The modal substack has a "Cancel" button:
> 
> on mouseup
>   close stack "myModals"
>   exit to top
> end mouseup
> 
> If the user cancels the modal substack, I do not want
> doSomeThings to execute.  But despite the "Exit To Top"
> control structure, doSomeThings does execute.  Why is that?
> 
> I do realize that I can get the results I desire by setting
> a global or a custom property in the substack and testing
> for it in the mainstack.  But I don't understand why "Exit
> to Top" doesn't work.
> 
> Thanks, in advance,
> Michael Binder
> 

Hi Michael,

You are right that passing data back from the closing modal to the 
calling handler and having the latter make the decision about what to do 
next is the usual or recommended way to work with modals.

The behaviour you note is interesting though as in normal stacks, the 
handler should run to the end. It seems that this is not the case in a 
modal stack, and any statements after the close stack command are 
ignored. Whether this is a bug or by design I can't say. I couldn't find 
anything in the dictionary that would lead me to expect this behaviour.

Martin Baxter




More information about the use-livecode mailing list