Re: Binding to two values
Re: Binding to two values
- Subject: Re: Binding to two values
- From: Clint Shryock <email@hidden>
- Date: Fri, 29 May 2009 08:13:46 -0500
I think the best way I can think of would be to have an object act as an
intermediate for this, which contains an aggregate array that
table3controller is bound to.
In this object define observers for tableview1controller and
tableview2controller's selection property, so that this object receives KVO
notifications when they change. In the observing method
(observeValueForKeyPath:ofObject:change:context:) do whatever logic you need
to do to based on the new selections, and update the aggregate array, making
sure to do so in a KVO Compliant way so the 3rd controller observes the
change and updates it's content accordingly.
+Clint
On Thu, May 28, 2009 at 12:30 PM, Kelvin Chung <email@hidden> wrote:
> I'm not sure the best way to do this, but suppose I have two
> NSArrayControllers, tableView1Controller and tableView2Controller. Now
> suppose I have an NSArrayController, table3Controller.
>
> What I am trying to do is to have it so that table3Controller's Content
> Array binding depend on both tableView1Controller.selection and
> tableView2Controller.selection (an NSValueTransformer will then transform
> this into an NSArray). Clearly, I can't bind to both unless I somehow
> aggregate the two together. What is the best way to do that?
> _______________________________________________
>
> 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
>
_______________________________________________
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