On Jun 23, 2011, at 10:17 AM, Daniel Luis dos Santos wrote:

> Hello,
> 
> I have a submenu of the File menu that gets loaded with menu items on 
> awakeFromNib().
> Problem is that the method that does the menu item enabling is not being 
> called on the submenu's items and so they are not enabled.
> 
> I implemented the validateUserInterfaceItem() method in a class and have set 
> the target of the created menu items to that class.
> It gets called for every menu item except the one with the submenu. If I 
> expand the submenu it doesn't get called.
> What am I missing ?

That message will be sent to the menu item's target if it implements 
-validateMenuItem: or -validateUserInterfaceItem: (to be pedantic, they are 
methods and not functions). Are you sure the target & action of the menu items 
are being set correctly? If the action wasn't set, then they won't be enabled. 
If the target wasn't set, and nothing in the responder chain implements the 
action, then they won't be enabled. If the target & action were set, then they 
should be enabled by default, but maybe the target implemented one of those 
methods and returned NO, which would explain why they're off.

Also, did you ensure -autoenablesItems is turned on in the submenu? It should 
be by default...

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to