Modality redux
Barry Levine
themacguy at macosx.com
Thu Sep 11 15:52:01 EDT 2003
I finally tracked down where the "hang" was occurring in my app. I had
something a little strange in my code for a particular routine and this
appears to have caused something "really bad" to happen when the app
was compiled. The two commands in the menubar near the offending lines
of code would initiate the problem but only if the Quit menu item was
chosen in the middle of the modal dialogs. Specifically, I removed one
"if" statement and the matching "end if" (about twenty lines down from
there) and the problem seems to have disappeard. I still think it's the
"lack of modality" bug because, if modality was enforced by Rev, this
would not have occurred.
The funny thing is that this app compiled and ran perfectly under
Windows (even with my now-disgraced code).
In any case, we still have a lack of modality with which we must deal.
So add a "cantQuit flag" - setting it to true immediately before you
head into a modal dialog and false or empty after you leave it - and
include a line of code in your shutDownRequest handler that checks the
flag before anything else; if it's true, dive out of the handler.
I used a global variable but a custom stack property might be more
succinct.
In case anyone is late in joining this thread (thank your lucky stars),
this is just an OSX issue AFAIK due to the way Rev moves the Quit menu
item over to the OSX app's menu but fails to include the requisite code
for disabling that menu item when a modal dialog is present. The same
app in Windows works fine because the menubar is -in- the window and
the modal dialog blocks access to the window's menu. I have not tested
this on OS9.
I'm gonna go have a beer and, if I could, I'd love to deliver one to
Alex, Ken, Thierry, et al; thanks for challenging me to find the root
cause.
Regards,
Barry
More information about the use-livecode
mailing list