• 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: Bindings and MenuItems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings and MenuItems


  • Subject: Re: Bindings and MenuItems
  • From: Andy Lee <email@hidden>
  • Date: Wed, 01 Apr 2009 07:12:38 -0400

On Apr 1, 2009, at 3:34 AM, Ben Lachman wrote:
I have a menu item that is bound to a target. The menu is resides in has "Auto Enables Items" checked which means that it should call - validateMenuItem on a items target if it is available. However validate is never called on the target. If I remove the binding and set the target to one of the objects manually in IB the validation method is called as expected. Has anyone else run into this and if so, is there a work around?

What do you mean "binding"? "Binding" has a very specific meaning, and is not how you connect an object to its target.


Do you mean you're making the connection in code? If so, it should look something like:

    [myMenuItem setTarget:myTarget];
    [myMenuItem setAction:@selector(doMyAction:)];

Note the name of the action method is "doMyAction:", not "doMyAction", though I don't know if this affects whether validateMenuItem: is called.

Assuming your code does look like this, are you sure these lines of code are being executed? If so, *when* are they being executed? If you doing this in init, it's possible myMenuItem and myTarget have not been set yet -- you need to make the connection in awakeFromNib.

--Andy

_______________________________________________

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: Bindings and MenuItems
      • From: Ben Lachman <email@hidden>
    • Re: Bindings and MenuItems
      • From: Keary Suska <email@hidden>
References: 
 >Bindings and MenuItems (From: Ben Lachman <email@hidden>)

  • Prev by Date: Re: Persistent store removal throwing invalidated NSManagedObject exceptions
  • Next by Date: Re: Best Strategy to Control iTunes
  • Previous by thread: Bindings and MenuItems
  • Next by thread: Re: Bindings and MenuItems
  • Index(es):
    • Date
    • Thread