Just ran into the same problem and came up with HHValidatedButton:
http://www.bernard-web.com/pierre/blog/index.php?id=6542976061063123843

Pierre Bernard

On Jul 1, 2009, at 11:24 PM, Bill Cheeseman wrote:

For years, the "Implementing Validation" section of Apple's "User Interface Validation" document has said the following:

"Before it is displayed, a user interface item checks to see if its target implements validateUserInterfaceItem:. If it does, then the enabled status of the item is determined by the return value of the method. You can therefore conditionally enable or disable an item by implementing validateUserInterfaceItem: in the target object."

This has never been true. Right?

My custom window controller implements the action method for a button, so it is the button's target, and it also implements - validateUserInterfaceItem:, all according to the User Interface Validation document. But my -validateUserInterfaceItem: method is never called.

If I want it to be called automatically, by analogy to - validateMenuItem:, I have to override NSWindow's -update method, by analogy to -[NSMenu update]. In my override of -update, I have to do for myself what the document claims already happens -- or I have to observe NSWindow's -NSWindowDidUpdateNotification. Right?


--

Bill Cheeseman
b...@cheeseman.name

_______________________________________________

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/pierre.bernard%40lists.houdah.com

This email sent to pierre.bern...@lists.houdah.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