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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to