Re: Menu item enabling
Re: Menu item enabling
- Subject: Re: Menu item enabling
- From: Daniel Luis dos Santos <email@hidden>
- Date: Fri, 24 Jun 2011 00:50:27 +0100
Hello,
I thought that by implementing the validation method it wouldn't matter if the menu item has an action set on it. That was the problem. Once I set the action, the validation method started being called.
Thanks,
Daniel
On Jun 23, 2011, at 5:42 PM, Nick Zitzmann wrote:
>
> 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@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