How to tell if a modal dialog is open?

Peter T. Evensen pevensen at siboneylg.com
Mon Feb 13 16:39:26 EST 2006


I was asking for the purposes of managing pending messages.  I have a 
screen that "lights" a series of circles on the screen.  There is a "new 
game" button that brings up a "are you sure you want to start a new game?" 
dialog.  I wanted to pause and resume the "LightNextCircle" message.  I did 
finally create a SuspendPendingMessages and a ResumePendingMessages handler 
for this purpose that I call on suspendStack and resumeStack, which works 
fine.  It goes through the pending messages, saves them, and figure out how 
much time each has.  When they are resumed, they are put back with the 
remaining time left.

It was my understanding that "this stack" will return the name of the 
top-most editable stack, so it would not return the modal dialog.  I just 
created a test, and it does:

"this stack" on an object in the modal dialog stack returns the modal 
dialog stack (as in "close this stack"), but in a message sent to the 
underlying stack, "this stack" returns the underlying stack.

I created a stack "Main Stack" with a button:

on mouseUp
   send CheckThisStack to me in 2 seconds
   modal stack "Modal Dialog Stack"
end mouseUp

on CheckThisStack
   answer the name of this stack
end CheckThisStack

The modal stack "Modal Dialog Stack" comes up. and then the answer dialog 
comes up with 'stack "Main Stack"' as the value of this stack, and not 
'stack "Modal Dialog Stack"'

At 03:27 PM 2/13/2006, you wrote:
>Peter T. Evensen wrote:
>>I was really after a method to tell if any (unknown) modal stack is 
>>open.  topStack gives the top-most editable stack.  I was wondering if 
>>there was a way to tell if a modal dialog was being displayed.
>
>This is an interesting question; given that modal dialogs block the flow 
>of the script that opened it this rarely comes up.
>
>Is this for managing pending messages?
>
>You should find that "this stack" refers to the modal stack, so a script 
>that asks "if the mode of this stack is 5 then" should do what you need.
>
>Can anyone think of a case where "this stack" would not return the modal 
>stack currently open?
>
>--
>  Richard Gaskin
>  Managing Editor, revJournal
>  _______________________________________________________
>  Rev tips, tutorials and more: http://www.revJournal.com
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your 
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution

Peter T. Evensen
http://www.PetersRoadToHealth.com
314-629-5248 or 888-628-4588 


More information about the use-livecode mailing list