Re: TreeController and "selection" Binding
Re: TreeController and "selection" Binding
- Subject: Re: TreeController and "selection" Binding
- From: Quincey Morris <email@hidden>
- Date: Thu, 11 Feb 2016 16:11:02 -0800
- Feedback-id: 167118m:167118agrif8a:167118sgSLTrlmpH:SMTPCORP
On Feb 11, 2016, at 13:26 , Michael de Haan <email@hidden> wrote:
>
> Currently, I obtain the “selection” of the treeController by implementing and outlet to the controller, and using the “selectionIndexPaths” binding to update a local variable which holds the selected range information. From then, another function implements the highlight. It works, but it seems awfully klunky.
>
> Ideally, I would like to bind from IB the selection of the TreeController to the local variable, but I cannot find a way to do this. Is this possible?
It’s not clear what you’re saying. NSTreeController supports a “selectionIndexPaths” binding that can be bound to a NSArray property via File’s Owner. [That sentence needs to be rephrased if you’re using Swift, or storyboards, but I’m assuming Obj-C and a XIB by default.] Your first quoted paragraph seems to say that this binding is bound, although it’s unclear how the outlet to the controller fits in.
The second quoted paragraph says you would like to do the thing that is apparently described by the first paragraph, hence my confusion. If it were bound in this way, you would still have “From then, another function implements …”, so isn’t that still clunky?
Or are you saying you’re currently observing the tree controller’s “selectionIndexPaths” *property* (not *binding*) using KVO or something else, and *that’s* what’s clunky?
Again, you can already do the thing you’re asking for. In IB, you can bind the NSTreeController’s “selectionIndexPaths” binding to something in a data model.
_______________________________________________
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