• 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
Re: newbie: why would a menu item be grayed out?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >newbie: why would a menu item be grayed out? (From: Adhamh Findlay <email@hidden>)

  • Prev by Date: newbie: why would a menu item be grayed out?
  • Next by Date: Re: Allocation in Pools and threads
  • Previous by thread: newbie: why would a menu item be grayed out?
  • Next by thread: Re: newbie: why would a menu item be grayed out?
  • Index(es):
    • Date
    • Thread