Re: validateMenuItem() not always being called
Re: validateMenuItem() not always being called
- Subject: Re: validateMenuItem() not always being called
- From: Michael Babin <email@hidden>
- Date: Mon, 19 May 2008 20:54:23 -0500
On May 19, 2008, at 7:08 PM, email@hidden wrote:
Any object's validateMenuItem method is only called for menu items
that
would message that object if they were invoked. That means:
* Menu items whose target directly points to that object
* Menu items whose target is "first responder", and your object is on
the responder chain and implements the item's action method.
Maybe you should tell us which command(s) aren't being validated
that you think should be?
I'm trying to validate the Edit menu. I added a custom view to the
window in
IB as shown in chapter 7 of Learning Cocoa With Objective-C, 2nd
Edition O'Reilly
and made it the first responder. To the view initialization method
I added this:
[[self window] makeFirstResponder:self];
I'm returning YES to acceptsFirstResponder and becomeFirstResponder.
So I would think I would get validateMenuItem messages for the view
but its not being called.
Re-read the documentation about the responder chain
I read the chapters on Automatic Menu Enablingand The Responder Chain.
Not sure what I'm missing.
So does your custom view implement the action method(s) for the
item(s) on the Edit menu which you are trying to validate (e.g., -
cut:, -:copy, etc)? If not, your custom view's validateMenuItem method
won't be called for those items.
_______________________________________________
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