Quitting when Menu closes
Quitting when Menu closes
- Subject: Quitting when Menu closes
- From: "Eric Celeste" <email@hidden>
- Date: Sat, 3 Nov 2007 11:51:36 -0500
I am writing an app (my first since NeXTSTEP days) that simply pops a
menu up at the mouse location, responds to the selection, then quits.
I have it doing everything I want except quitting. It should quit
whenever the menu closes, whether an item has been chosen or not. How
can I get the app to quit when nothing has been chosen from the menu.
I have no problem quitting the app when a menu item is chosen. I
simply terminate the app after performing the desired menu item
action.
BUT, when the user simply drags the mouse off the menu so it closes
without making any selection, then I can't get it to quit properly.
The menu is in a PopuUpButton "_menuButton" which lives in a Window.
In the window's awakeFromNib I put...
[[_menuButton menu]setDelegate:self];
And then in among the methods for the window I include...
- (void)menuWillClose:(NSMenu *)menu
{
[self close];
}
(Note, the app is set to quit when that window closes and the [self
close] works find for quitting the app whenever a selection _is_
made.)
But this does not work. When the user drags the mouse off the menu, no
menuWillClose event seems to be generated.
Any ideas what I'm doing wrong? Any other thoughts on how to quite the
app upon the menu close?
Thanks,
...Eric
--
Eric Celeste / email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden