Jason,

Yes, I've read up on menu validation (more than once).

I got here because my application has a few table and/or outline views in the document window, and I wanted "Select All" to be directed to one in particular (a master list) whenever the current first responder does not respond to selectAll:. I was handling this by implementing selectAll: in my document subclass and re-directing it to the master table. I assumed (ah, there's my problem...) that NSOutlineView, since it implements selectAll:, would be implemented to enable a Select All menu item that might reasonably be targeted at the first responder's selectAll:, and figured that the document should/could delegate the validation to the table.

If I had seen the exception soon after adding the code, I probably would have figured it out. But the code was in place for months before we first noticed an exception being thrown (our QA testers regularly check the console for exception messages), so I assumed that that particular piece of code was OK.

Reflecting on all this, it would appear that the menu item was (almost) always being validated by something in the responder chain ahead of the document. And that I should assume less often. :-)

Andy, Jason, thanks very much for your time and help.

Best regards,
Doug K;

On Jan 29, 2009 5:12pm, Jason Foreman <ja...@threeve.org> wrote:
On Thu, Jan 29, 2009 at 2:37 PM, Doug Knowles knowles.d...@gmail.com>
wrote:

> And why is the exception only thrown infrequently (and persistently
once it

> starts), when it's normally successfully invoked every time a click on
the

> respective menu?



The real question is why is the exception not thrown every time.

NSTableView doesn't seem to implement validateMenuItem:.

NSObjectController is an example of a class that does. Perhaps you

are using an NSArrayController for your table's data, in which case

you can call validateMenuItem: on that. It'd still be a good idea to

check respondsToSelector first.



You've read this?



http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/20000261-74653





Jason

_______________________________________________



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/knowles.doug%40gmail.com



This email sent to knowles.d...@gmail.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