OSX Modality test - 9/11/03
Barry Levine
themacguy at macosx.com
Thu Sep 11 12:55:00 EDT 2003
Using v2.1 of both the OSX and Windows version of Rev, I created a
stack with three buttons. These bring up the following allegedly modal
dialogs:
1. Answer
2. Ask
3. open stack "myStack" as modal
Then I compiled an OSX app on both OSX and Windows(XP) and tested them
both on my Mac.
In the case of the "answer" dialog, selecting Quit (it is not disabled)
does nothing. This is the expected result.
In the case of the "ask" dialog" selecting Quit calls the
shutDownRequest handler in the stack script. If approved, the app will
quit (in the middle of the modal dialog).
In the case of the "open stack...as modal" dialog, the same result as
the "ask" dialog happens.
The results seems to be the same whether compiling in OSX or WindowsXP.
Now the workaround. In the shutDownRequest handler try this:
on shutDownRequest
global cantQuit
if cantQuit is "true" then exit shutDownRequest
answer "Are you sure you want to quit?" with "Quit" or "Cancel"
if it is "Quit" then pass shutDownRequest
end shutDownRequest
----
In the button handler that brings up either the "ask" dialog or the
"open stack...as modal" dialog, try this:
on mouseUp
global cantQuit
put "true" into cantQuit
-- (your "ask" or "open stack...as modal" command goes here)
put empty into cantQuit
end mouseUp
----
Probably can do all of this as a custom stack property instead of the
global variable. Of course, if Rev would simply disable the Quit menu
item when it is supposed to do so (in a modal situation), I wouldn't
have to kludge this together.
This solution (either global var or stack property) will still work
when Rev gets around to fixing this problem so you won't -have- to
excise the code in order to keep the app working if you recompile.
If you'd like my stacks (8K in total), drop me a note and I'll eMail
them to you.
Regards,
Barry
More information about the use-livecode
mailing list