Intercepting Command-Q


#1

Hi folks, when I press Command-Q in the Juce app I’m writing, it seems to call AppClass::shutdown directly, and there’s no way to abort shutting down at that point. What I’d like to do is pop up a dialog asking the user if they are sure that they want to quit. If not, they should be able to go back to using the app.

I should note that on Windows, pressing Alt-F4 seems to call my DocumentWindow’s closeButtonPressed method, which allows me to handle the situation I described above. Just wondering how to do so on Mac.

Thanks.


#2

Try hooking JUCEApplication::systemRequestedQuit.

Matt


#3

Oh yeah. Duh. Didn’t see that. Thanks.