Hi, Jim,

Try implementing validateMenuItem: instead.

It's been my experience that validateUserInterfaceItem: is only called for
toolbar items; there may be other cases, but I haven't run across them, and
I've never seen it called on menu items.

When I do use validateUserInterfaceItem: (for buttons in my UI, for
example), I use a subclass of NSButton that implements
the NSUserInterfaceValidations protocol, and even then I have to "walk" the
view hierarchy and explicitly call validateUserInterfaceItem: on controls
that implement the protocol.

Maybe there's a better way to finesse this, but it's what has worked for me.

Hope this helps,
Doug Knowles

On Thu, Dec 17, 2009 at 12:24 PM, Jim Majure <jim.maj...@mac.com> wrote:

> Hello,
>
> I'm having problems enabling the "Edit>Delete" menu item on a custom view.
>  Here's what I have tried:
>
> - I have linked the Delete menu item to the "delete:" selector of the First
> Responder in IB.
> - I have implemented the "(IBAction) delete: (id) sender;" on my custom
> view.
> - I have implemented the "(BOOL)validateUserInterfaceItem:(id
> <NSValidatedUserInterfaceItem>)item" on my custom view
> - I have confirmed that my view is being set as first responder at runtime
> (via acceptsFirstResponder, becomeFirstResponder, resignFirstResponder)
>
> The "Delete" menu item never becomes enabled. I can get the "Cut" menu item
> to enable and activate when tied to the "cut:" selector, but no luck with
> "Delete". I'm sure that I'm overlooking something very simple, but being a
> newbie, I can't figure out what.
>
> Thanks,
> Jim
> _______________________________________________
>
> 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/knowles.doug%40gmail.com
>
> This email sent to knowles.d...@gmail.com
>
_______________________________________________

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