On 14 Jun 2011, at 22:39, Quincey Morris wrote: > When you connect an action to "First Responder", that doesn't mean that it's > sent to the first responder object, but rather that it's sent to the first > object in the responder chain that implements the action.
OK, I'm sure I understand this. Sorry I haven't been any clearer in my original message. > Therefore, in situations like this, you need to insert your view controller > into the responder chain. Set the view's next responder to be the view > controller, and set the view controller's next responder to be whatever the > view's next responder used to be. I'm not sure I understand how to accomplish this. What I have already tried, is message the window with "makeFirstResponder:" passing my view controllers as a parameter. This initially seemed to work fine; until I add an extra view with some textfields to the content pane. Now, it appears that my validation method does not get called anymore, leading me to the conclusion that somehow my view controllers are no longer part of the responder chain. I used NSLog to find out the kind of object that is my window's "first responder" and "next responder"; but the last method returns nil, which I don't understand. So, I'm not sure how I can insert my view controllers in the responder chain in a way that will make your above explanation all work. > > The validation message gets sent to whatever object has been chosen to > perform the action (that is, if the action is directed at "First Responder", > the target is determined first, and validation is sent to that object). The > responder chain isn't involved directly in validation, because the target is > already known. > For actions implemented in your view controller, your validation method can > choose to "delegate" validation to other implementations (e.g. super) or to > other objects (e.g. a window controller). Normally, though, the fact that the > validation message has arrived at the view controller means that the view > controller is the object that knows how to do the validation, so the > flexibility that's theoretically available here is of limited use. > Ok, I understand. > _______________________________________________ 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