• 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: Programming Context Menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programming Context Menu


  • Subject: Re: Programming Context Menu
  • From: Graham Cox <email@hidden>
  • Date: Tue, 05 Apr 2011 16:10:29 +1000

On 05/04/2011, at 1:37 PM, Bing Li wrote:

> I noticed that no IBAction/IBOutlet is available for the items in the code.
> Should I make some connections for them?

Yes, but the outlets aren't visible to code because 'IBOutlet' is an IB thing.

You need to call -setTarget: on the menu items with the view that is the target for the command. If you don't the target by default is nil i.e. 'First Responder'. That is usually not what you want for contextual menus which should be operable without becoming first responder.

You still may find that the items aren't enabled, depending on whether -validateMenuItem: or -validateUserInterfaceItem: is implemented and if so, whether it takes steps to enable the items.

There's plenty of info about this in the relevant docs.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Programming Context Menu (From: Bing Li <email@hidden>)
 >Re: Programming Context Menu (From: Bing Li <email@hidden>)

  • Prev by Date: Re: Programming Context Menu
  • Next by Date: Passing an object to a custom sheet
  • Previous by thread: Re: Programming Context Menu
  • Next by thread: Re: Programming Context Menu
  • Index(es):
    • Date
    • Thread