|
Replies:
3
-
Last Post:
Apr 8, 2008 8:13 PM
by: alavideo
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
mac application quit (commad+Q) bypassing appframework shutdown() method
Posted:
Apr 7, 2008 7:29 PM
|
|
|
Hello, I'm sure this has been asked before but searching this forum didn't turn up any results. What is the solution for getting the application framework to call the framework's "shutdown()" method when using the mac's application quit keyboard shortcut (command+Q)? The appframework automatically adds the proper keyboard shortcut to the "exit" menu, but using the shortcut just seems to exit the app without calling the framework shutdown() method. Any help would be much appreciated.
Regards, Jim
|
|
|
|
|
|
|
|
|
Re: mac application quit (commad+Q) bypassing appframework shutdown() metho
Posted:
Apr 8, 2008 8:13 PM
in response to: lmineiro
|
|
|
Imineiro, That link was EXACTLY what I needed. I was able to take the sample code and incorporate it into the appframework in just a matter of minutes! Now the cmd-Q event properly lets the app framework's exit() method handle the quit/shutdown.
Thanks! Jim
|
|
|
|
|
|
|
|
Re: mac application quit (commad+Q) bypassing appframework shutdown() metho
Posted:
Apr 8, 2008 10:06 AM
in response to: alavideo
|
|
|
I presume you're using the com.apple.eawt library.
Have you registered an ApplicationListener? Does its handleQuit method call the event's setHandled method?
As I recall it, if you don't have an ApplicationListener registered, it will default to calling System.exit().
If you have registered an ApplicationListener, then if the ApplicationEvent's handled property is set to true, then it will (again) call System.exit().
To cancel exit, or to handle it in your own way, you will need an ApplicationListener, and it's handleQuit method should NOT call event.setHandled( true ).
|
|
|
|
|