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 (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