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

Re: Menu item enabling


  • Subject: Re: Menu item enabling
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 23 Jun 2011 10:42:28 -0600

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

  • Follow-Ups:
    • Re: Menu item enabling
      • From: Daniel Luis dos Santos <email@hidden>
References: 
 >Menu item enabling (From: Daniel Luis dos Santos <email@hidden>)

  • Prev by Date: Re: Animating handwriting
  • Next by Date: Re: Animating handwriting
  • Previous by thread: Menu item enabling
  • Next by thread: Re: Menu item enabling
  • Index(es):
    • Date
    • Thread