Re: Menu item enabling when NSView is first responder?
Re: Menu item enabling when NSView is first responder?
- Subject: Re: Menu item enabling when NSView is first responder?
- From: Greg Titus <email@hidden>
- Date: Wed, 7 Nov 2001 12:57:49 -0800
On Wednesday, November 7, 2001, at 12:42 PM, Robert Miller wrote:
Here's probably a basic question that I haven't been able to find an
answer to. How do you enable / disable menu items say, in the Edit menu
when you have an NSView that is the first responder ? I know that an
NSDocument uses validateMenuItem but, cannot find the equivalent for an
NSView / NSResponder ? Any help is greatly appreciated.
Actually, -validateMenuItem: goes through the responder chain, so you
can just implement it on your NSView subclass and it'll work just as
you'd expect. Also, menu items will automatically disable themselves if
there is nothing in the responder chain that responds to their selector
so you can feel free to add menu items with selectors that only your
view responds to and the items will automatically disable themselves
when your view isn't the first responder.
Hope this helps,
-Greg