• 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: Enabling NSMenuItem in Code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enabling NSMenuItem in Code?


  • Subject: Re: Enabling NSMenuItem in Code?
  • From: "David Piasecki" <email@hidden>
  • Date: Wed, 21 Apr 2004 10:15:21 -0700

Thanks, adding that line worked.

David


On Apr 20, 2004, at 6:50 PM, James Chen wrote:

Hi,
Since the default behavior of menu enabling is "Automatic". (Please refer to http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/ Tasks/EnablingMenuItems.html)
That is, once the target of menu item implements the action of it then the menu item will be enabled.
So one thine left you have to do is:
after your code
NSMenuItem *menuItem = [IconsMenu addItemWithTitle:@"New Menu Item" action:@selector(MenuItemSelected:) keyEquivalent:@""];
[menuItem setTarget:theTarget]; // theTarget which implements method MenuItemSelected:
I think that menuItem will be enabled.
HTH,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
_______________________________________________
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: 
 >Enabling NSMenuItem in Code? (From: "David Piasecki" <email@hidden>)
 >Re: Enabling NSMenuItem in Code? (From: James Chen <email@hidden>)

  • Prev by Date: Re: Transparency? SOLVED
  • Next by Date: Re: pesky nib file problems
  • Previous by thread: Re: Enabling NSMenuItem in Code?
  • Next by thread: Re: Enabling NSMenuItem in Code?
  • Index(es):
    • Date
    • Thread