On Jul 11, 2014, at 2:24 AM, Shane Stanley <sstan...@myriad-com.com.au> wrote:

> FWIW, in my cell-based version I used 
> textView:willChangeSelectionFromCharacterRange:toCharacterRange: in my 
> outline view subclass. But that no longer seems to get called.

In general, an NSCell is owned by a control (instance of some subclass of 
NSControl).  An NSCell uses the field editor, an instance of NSText or a 
subclass (usually an NSTextView or subclass, more specifically), to handle the 
actual editing.  The field editor uses the control which owns the NSCell as its 
delegate.  That control receives the NSTextViewDelegate and, by extension, 
NSTextDelegate method calls.  Since an NSTextFieldCell is a kind of NSCell, all 
of the above applies to it, too.

In a cell-based outline view, the outline view is the control owning the 
NSTextFieldCell.  There's no actual NSTextField.  The text view which is the 
field editor uses the outline view as its delegate.  That's why it gets that 
delegate method.

In your view-based outline view, there's an actual NSTextField (or subclass).  
That's a control unto itself.  So, it (and not the outline view) serves as the 
field editor's delegate.  You can use a custom subclass of NSTextField and it 
will receive the delegate calls.  If you want, you can make your custom 
NSTextField forward the text view delegate methods to its own delegate.  So, 
your custom text field would not need to incorporate the logic specific to your 
outline view, it could just be a generic utility class.  (I'm a bit surprised 
that NSTextField doesn't already do this for those NSText[View]Delegate methods 
which don't already map to NSControlTextDelegate or the informal NSControl 
delegate methods.  Have you tried setting your text field's delegate to your 
outline view or some appropriate controller?)

Regards,
Ken


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to