Re: View-based outline view problem
Re: View-based outline view problem
- Subject: Re: View-based outline view problem
- From: Ken Thomases <email@hidden>
- Date: Fri, 11 Jul 2014 03:37:57 -0500
On Jul 11, 2014, at 2:24 AM, Shane Stanley <email@hidden> 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 (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