Re: validateMenuItem: and the Responder Chain
Re: validateMenuItem: and the Responder Chain
- Subject: Re: validateMenuItem: and the Responder Chain
- From: Seth Willits <email@hidden>
- Date: Mon, 7 Feb 2005 07:49:31 -0800
On Feb 7, 2005, at 4:17 AM, Tom Birch wrote:
When a menu item's target is first responder (ie nil) and different
classes in the responder chain each implement validateMenuItem:, eg a
subclass of NSDocument and NSApp's delegate, then how does it decide
to validate or not? Does it poll all objects in the chain that respond
to this method, and take the OR of the results? because it doesn't
really make sense for it to let one take precedence over another since
the common behaviour is to return NO unless the NSMenuItem is a
specific one and certain conditions are met.
so yeah, how does it work? This is purely for my interests, I'm not
writing an app that relies on this, but I'd still like to know
It's explained here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/
Tasks/EnablingMenuItems.html#//apple_ref/doc/uid/20000261>
Basically, it searches up a tree starting with first responder. If an
object responds to the action and returns true in validateMenuItem:
it's enabled. If it responds to the action but doesn't have a
validateMenuItem:, it's enabled. Otherwise, it's not enabled and
continues to search up the tree.
Seth Willits
------------------------------------------------------------------------
---
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic
"Organized people are just too lazy to look for things."
--
------------------------------------------------------------------------
---
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden