Skip navigation.
 
mlRe: Quitting when Menu closes
FROM : Eric Celeste
DATE : Sat Nov 03 22:44:20 2007

> > Any ideas what I'm doing wrong?
>
> Nothing.


OK. At least that makes me feel a bit better!

> > Any other thoughts on how to quit the
> > app upon the menu close?
>
> If something is hard to do in Cocoa, it's usually because it's - at
> least - uncommon.
>
> Why would you want to close your application if the user *aborts* an
> action? That's not at all intuitive.
>
> While it's most likely still possible (involving subclassing,
> probably), I think shouldn't waste more time on that.


I'm writing an app similar to DejaMenu, but designed to be launched
(by a Mighty Mouse click), do its work (present a copy of the menu bar
at the current mouse location), and disappear. So far all works well
except the disappear. If the user aborts the menu in this case, they
are aborting the whole app. It should just disappear.

This is certainly an uncommon case. I've tried the notification
approach as well, but it seems that NSMenuDidEndTrackingNotification
is sent before NSMenuDidSendActionNotification (I'm writing a test app
to confirm that right now), so that just resulted in the whole app
terminating before legitimate actions were taken.

I am puzzled that my window, which is set up as a delegate for the
menu, does not seem to be getting the menuWillClose: call.

Of course, if there is another way to sense an aborted menu close (as
opposed to a proactive click on a menu item) that would be ideal.

...Eric

--
Eric Celeste / http://eric.clst.org / Saint Paul, MN / 651-323-2009 /
<email_removed>

Related mailsAuthorDate
mlQuitting when Menu closes Eric Celeste Nov 3, 17:51
mlRe: Quitting when Menu closes Andreas Mayer Nov 3, 19:23
mlRe: Quitting when Menu closes Eric Celeste Nov 3, 22:44
mlRe: Quitting when Menu closes John Stiles Nov 3, 23:01