• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
newbie: why would a menu item be grayed out?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: newbie: why would a menu item be grayed out?
      • From: Greg Hulands <email@hidden>
  • Prev by Date: Re: Does any one know how to get a running processes id?
  • Next by Date: Re: newbie: why would a menu item be grayed out?
  • Previous by thread: NSBitmapImageRep questions
  • Next by thread: Re: newbie: why would a menu item be grayed out?
  • Index(es):
    • Date
    • Thread