setNextResponder confusion redux
setNextResponder confusion redux
- Subject: setNextResponder confusion redux
- From: Matt Neuburg <email@hidden>
- Date: Sat, 29 Jul 2006 12:57:00 -0700
- Thread-topic: setNextResponder confusion redux
>From the new "Cocoa Event-Handling Guide" currently starring at
developer.apple.com:
===
(1)
<http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/Eve
ntArchitecture/chapter_2_section_5.html>
"You should never send setNextResponder: to an NSView object."
(2)
<http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/Eve
ntArchitecture/chapter_2_section_6.html>
"You can insert other responders between NSView objects..."
===
How would you do (2) without violating (1)?
Personally, I think (1) is a myth. I routinely insert responders into the
view hierarchy without any problems. Provided you remember that this is a
linked list, so that you setNextResponder: both on the NSView object and on
the NSResponder you insert behind it [NB the docs still fail to mention that
this is necessary!], and provided of course that you do not subsequently
manipulate the view hierarchy in code, there is no difficulty. For example,
I commonly modify the behavior of an NSTableView so that it responds to the
Home and End keys (functionality mysteriously left out of the built-in
classes), and I like to do this by inserting an NSResponder after the
NSScrollView containing the table, rather than e.g. after the window.
Apart from this, I'm finding these new docs really great. The stuff on the
responder chains is particularly good; the docs have never before had this
correct, so it's a badly needed improvement. Bravo.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden