Re: Problems with a chain of bindings and search field
Re: Problems with a chain of bindings and search field
- Subject: Re: Problems with a chain of bindings and search field
- From: Michael McCracken <email@hidden>
- Date: Sun, 17 Jul 2005 19:38:38 -0700
This particular problem was solved by simply binding the detail view's
array controller directly to the master array controller, and not
using an intermediate array instance variable. Now that I thought of
doing this, I can't explain why I thought I needed that ivar in the
first place.
After doing that, binding an NSSearchField's predicate binding to the
master array controller works as advertised. Nice.
I suspect I wasn't doing the appropriate KVO updating for the child
controller's ivar, but I can't easily verify that. If anyone has some
insight into why that doesn't work when a direct connection between
two NSArrayControllers does, then I'd be very interested to know.
In any case, the solution results in less code, which must be a good thing.
Cheers,
-mike
On 7/17/05, Michael McCracken <email@hidden> wrote:
> Hi, I have a master-detail interface where I am dynamically switching
> between detail views based on the selection in a master outilne view.
>
> I have this set up with an NSArrayController in each 'child' detail
> view controller class being bound to an ivar in the child controller,
> and the master window controller binds that ivar to the selection
> binding of the master NSTreeController when switching. I can unbind,
> swap, and re-bind the child controllers and their individual bindings
> would work fine.
>
> Until I wanted to add a search field:
>
> Each selected object in the tree controller is a kind of group that
> has an 'items' relationship. What I want is for a global search field
> to be able to handle searching through whatever items might be
> selected, so I added a new NSArrayController next to the master
> NSTreeController and bound it to the selection.items key path of the
> tree controller, then bound the arrangedObjects of that new array
> controller to the child controller's ivar. However, even without
> adding in a search field to filter the array controller's objects, the
> child views are no longer being updated.
>
> I have the accessor for one of the child views printing out when it is
> updated, and it happens only once - just the first time I add a data
> item to the relationship.
>
> Should I be doing this in a different way?
>
> I was hoping to make it easy to write the detail controllers and
> views, so that they could just get the appropriate pre-sorted array
> from the master controller. This is turning into quite the learning
> experience.
>
> Thanks for any advice,
> -mike
>
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/blog/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden