Cannot exit to top in modal

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue May 29 03:20:20 EDT 2007


Hi Michael,

Le 29 mai 07 à 05:15, Michael Binder a écrit :

> 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

You might take advantage of the dialogData property.
For instance, from a recent post:

put "OK" into tBtn1
put "Cancel" into tBtn2
put "Are we going to the cellar?" into tPrompt
set the dialogData to tBtn1 & cr & tBtn2 & cr & tPrompt
modal stack "MyAsnwer" -- this will trigger preOpenStack in MyAnwser:  
see below
if the dialogData then doSomething -- see btn scripts below that have  
changed the contents of the dialogData in the meantime :-)
etc.

on preOpenStack
   set the label of btn "OK" to line 1 of the dialogData
   set the label of btn "Cancel" to line 2 of the dialogData
   put line 3 of the dialogData into fld "Prompt"
   -- your dialog is now customized
   etc.

on mouseUp -- btn "Cancel"
   set the dialogData to false
   close this stack
end mouseUp

on mouseUp -- btn "OK"
   set the dialogData to true
   close this stack
end mouseUp

Hope this helps
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
http://www.sosmartsoftware.com/
eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list