Re: Responder chain vs find panel
Re: Responder chain vs find panel
- Subject: Re: Responder chain vs find panel
- From: Sean Murphy <email@hidden>
- Date: Wed, 6 Dec 2006 22:37:15 -0500
On Dec 4, 2006, at 10:42 PM, Paul Collins wrote:
When the Find panel is opened, all the Find submenu items are
disabled, and I can't find which object, if any, is receiving -
validateMenuItem messages for the items. I suspect it's the
NSTextView in my
My document no longer gets them, nor does my find panel
controller, or even a diagnostic subclass of the find panel (NSPanel).
Hi Paul,
-validateMenuItem is not sent if no object in the responder chain
implements the action message in the first place. So, for some
reason, when the find panel is open and its text field is the panel's
firstResponder, the chain is broken and nothing along it seems to
implement performFindPanelAction.
There's also another issue I found which might even be to blame for
the original problem. Try this: make one of your document windows
key and tab out of the NSTableView and focus one of the buttons (make
sure full keyboard access is enabled - hit ^F7). Now, open up the
find panel and initiate a search. This causes the following
exception to be raised:
2006-12-06 22:12:12.315 FindPanel[4835] Exception raised during
posting of notification. Ignored. exception: *** -[NSButton
delegate]: selector not recognized [self = 0x37c770]
So, I'd re-check the way in which the find panel works for your
application. Also, when using a delegate, it's best to ensure the
object can deal with the method you're sending to it, instead of
simply verifying that the delegate exists:
if ([delegate respondsToSelector:@selector(someMethod)])
[delegate someMethod];
instead of:
if (delegate)
[delegate someMethod];
Since messages can be safely sent to nil, the first technique will
avoid sending someMethod even if there is no delegate (without
explicitly checking that it exists).
I'm sorry I can't offer a real solution, just a little bit of
insight. I'd suggest reading the following ADC docs, and hopefully
they will help you determine what's going on here:
Responder Chain for Action Messages
<http://developer.apple.com/documentation/Cocoa/Conceptual/
EventOverview/EventArchitecture/chapter_2_section_6.html#//apple_ref/
doc/uid/10000060i-CH3-SW9>
Automatic Menu Enabling
<http://developer.apple.com/documentation/Cocoa/Conceptual/MenuList/
Tasks/EnablingMenuItems.html#//apple_ref/doc/uid/20000261-74653>
- Sean
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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