Re: User interface validation doesn't work, right?
Re: User interface validation doesn't work, right?
- Subject: Re: User interface validation doesn't work, right?
- From: Keary Suska <email@hidden>
- Date: Wed, 1 Jul 2009 19:15:30 -0600
On Jul 1, 2009, at 5:27 PM, Bill Cheeseman wrote:
My controller is the target, which according to Apple's
documentation, and according to my understanding for many years,
means simply that it implements the button's action method. My
controller does in fact implement the action method. In addition, my
controller is in the responder chain, which is demonstrated by the
fact that the action method, which is connected to the First
Responder proxy in Interface Builder, executes correctly when I
click the button. Also, I declare the controller to conform to the
NSUserInterfaceValidations protocol, which it does because it
implements the -validateUserInterfaceItem: method. NSButton does
conform to the NSValidatedUserInterfaceItem protocol, as its header
file confirms, and it does implement the -action: and -target:
methods required by that protocol.
So I think you are claiming this works because the documentation
says so. I'm saying the documentation is wrong because it doesn't
work. I would love to see a project proving me wrong. Can you show
me one?
No, I am saying that it works as advertised for objects that it works
for. NSButton is not one of them, and never has been. You seem to
assume that all user interface items should, but they don't, and never
have, and the documentation has never said that they did. The
documentation is explicit:
"The protocols NSUserInterfaceValidations and
NSValidatedUserInterfaceItem provide a standard way to validate user
interface items—that is, to set their state as appropriate for the
current application context"
Validation is not a function of user interface items, it is a function
of the protocol(s) listed. Neither NSButton, nor any of its parents
conforms to the protocol, so none of them support validation of this
kind. Look at NSMenuItem, and you will see that it does, and that your
validation method will always be called.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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