newbie: why would a menu item be grayed out?
newbie: why would a menu item be grayed out?
- Subject: newbie: why would a menu item be grayed out?
- From: Adhamh Findlay <email@hidden>
- Date: Mon, 14 Jun 2004 23:32:20 -0500
Hi another newbie question...
I've got this code snip:
newItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]]
initWithTitle:@"Quit" action:NULL keyEquivalent:@"q"];
[newItem setKeyEquivalentModifierMask: NSCommandKeyMask];
[newItem setTarget: self];
[newItem setAction:@selector(stop)];
where [self stop] is :
}
- (void)stop
{
//makeMainWindow above set the application's main window. now we
can orderFront: nil
//which makes it disappear.
[[NSApp mainWindow] orderOut:[NSApp mainWindow]];
//this quits the application.
[NSApp terminate: NSApp];
}
I see the Quit item with is key equivalent, but it is grayed out. If I
setTarget to NSApp and setAction to terminate: the item is not grayed
out. So I guessing that maybe the stop method isn't being found
properly, but I don't understand why.
Also, is it "correct" to just call [NSApp terminate:] or should I close
the window first?
Thanks!
Adhamh
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.