shutDownRequest ignored - yes, it -is- a reproducible bug
Barry Levine
themacguy at macosx.com
Sun Sep 7 01:01:01 EDT 2003
Consider the following two handlers. Both allegedly will intercept the
"Quit" when selected from the OSX app menu. In both cases, with
multi-stack apps, either handler (I only use one or the other) will
only be executed the first time it is called.
---------------------------------------------------------------
on shutDownRequest
answer information "Are you sure you want to quit?" with "Quit" or
"Don't Quit" as sheet
if it is "Quit" then pass shutDownRequest
end shutDownRequest
---------------------------------------------------------------
on appleEvent theClass,theID
if theClass is "aevt" and theID is "quit" then
answer information "Are you sure you want to quit?" with "Quit" or
"Don't Quit" as sheet
if it is "Quit" then pass appleEvent
end if
end appleEvent
---------------------------------------------------------------
I can reproduce this "works only the first time" behavior. Here is how
I did it:
1. Create a stack. Let's call it "splashtest". Save it as
"splashtest.rev". Add this handler to the stack script:
on openStack
wait 2 seconds -- so we can see we're here
hide this stack
go stack "maintest.rev"
end openStack
2. Save and close the stack.
3. Now create that "maintest" stack and save it in a file named
"maintest.rev". Add this handler to the stack script:
on shutDownRequest
answer information "Quit?" with "Quit" or "Cancel"
if it is "Quit" then pass shutDownRequest
end onShutDownRequest
4. Save and close the stack.
5. Create a Distribution using "splashtest.rev" as the main stack to
which the engine will be attached. Add "maintest.rev" to the
distribution, as well. Make sure you check the Answer Dialog inclusion.
Build it.
6. Run the app. Select "Quit" from the app menu. You'll get the
confirmation dialog. Click "Cancel" and the app will stay running.
Select "Quit" from the app menu again. The app will just quit.
QED. This is an OSX bug. I have the stacks and the compiled app I can
eMail to anyone who is interested.
Barry
More information about the use-livecode
mailing list