Re: View-based outline view problem
Re: View-based outline view problem
- Subject: Re: View-based outline view problem
- From: Shane Stanley <email@hidden>
- Date: Fri, 11 Jul 2014 19:37:42 +1000
On 11 Jul 2014, at 6:37 pm, Ken Thomases <email@hidden> wrote:
> 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.
Ken,
Thanks for the detailed explanation. I'll look into this approach.
> (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?)
Yes, I have, but with no joy.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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