Page 1 of 1

shutdownRequest handler

Posted: Fri Jun 29, 2012 2:10 am
by Christo777
Hi,
when I quit my standalone app, this code should execute but it does not. It is in the script of the main stack.
Have an idea ? tx

Code: Select all

on shutdownRequest
   answer question "Are you sure you want to quit?" with "Yes" or "No"
   if it is "Yes" then 
      send closecard to card 1 of stack "Sans titre"
      pass shutdownRequest -- allow to quit
   else
      answer "we don't quit"     
   end if
end shutdownRequest
I just found that if I issue a Quit command from a button, the previous script does execute ! But if the user chooses Quit MyApp from the App menu, it does not. How do I trap this ??

Re: shutdownRequest handler

Posted: Fri Jun 29, 2012 6:44 am
by shaosean
http://lists.runrev.com/pipermail/use-l ... 12239.html

You can always try trapping for the Quit AppleEvent as mentioned in this posting

Re: shutdownRequest handler

Posted: Sat Jun 30, 2012 3:29 am
by Christo777
I can try that but that would solve only half of the problem (on MacOS only).
For the other platforms, can I trap the "Quit" menuitem in my File menu button ?

I really would want to know why my handler doesn't catch the request.
Should I put this question in another topic of the forum ?

Thank you

Re: shutdownRequest handler

Posted: Sat Jun 30, 2012 10:04 am
by shaosean
Are you setting the lockMessages property anywhere in your code?