Re: newbie: why would a menu item be grayed out?
Re: newbie: why would a menu item be grayed out?
- Subject: Re: newbie: why would a menu item be grayed out?
- From: Greg Hulands <email@hidden>
- Date: Tue, 15 Jun 2004 14:43:05 +1000
My guess is stop should be
- (void)stop:(id)sender;
and change the selector to stop:
This is because of target/action paradigm
HTH,
Greg
On 15/06/2004, at 2:32 PM, Adhamh Findlay wrote:
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.
_______________________________________________
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.