Re: Why does NSTableView stop responding to validateMenuItem: ?
Re: Why does NSTableView stop responding to validateMenuItem: ?
- Subject: Re: Why does NSTableView stop responding to validateMenuItem: ?
- From: Andy Lee <email@hidden>
- Date: Thu, 29 Jan 2009 15:56:33 -0500
On Jan 29, 2009, at 3:37 PM, Doug Knowles wrote:
Thanks for the response, but...
As I understand it, NSMenuValidation is an informal protocol and
doesn't
have to be declared as implemented; in fact, I can't find a class
that does.
Maybe I should lose my Obj-C license for asking, but isn't it
sufficient
that NSObject declares and implements validateMenuItem: to prevent the
NSTableView class from throwing an unrecognized selector exception?
Sorry, my answer was sloppy. An object needs to *implement* a method
in order for respondsToSelector: to find it. Whether the method is
declared is irrelevant.
I don't see any evidence that NSObject *implements*
validateMenuItem:. I suspect you're seeing a category of NSObject
that declares the method? If so, that is only to silence compiler
warnings. It has nothing to do with respondsToSelector:. And
precisely because NSMenuValidation is an informal protocol, NSObject
is not required to implement the method.
If you happen to implement validateMenuItem: in a category or subclass
of NSTableView then I'd expect respondsToSelector: to return YES;
otherwise, not.
--Andy
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?
I'm inclined to suspect a mangled object or class descriptor (since
I do
have C++ code linked into my app); I am doubtful of that diagnosis
only
because the object & class seem otherwise intact when the problem is
occurring.
Thanks,
Doug K;
On Thu, Jan 29, 2009 at 10:50 AM, Andy Lee <email@hidden> wrote:
On Jan 29, 2009, at 10:41 AM, email@hidden wrote:
Using the debugger, I've sent respondsToSelector: messages to it
with
selectors of various methods an NSTableView should respond to, and
the only
response that comes back wrong is validateMenuItem:
NSTableView does not implement the NSMenuValidation protocol,
thought it
does implement NSUserInterfaceValidations.
--Andy
_______________________________________________
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
_______________________________________________
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