Re: completely messed up with bindings...
Re: completely messed up with bindings...
- Subject: Re: completely messed up with bindings...
- From: "Vitaly Ovchinnikov" <email@hidden>
- Date: Thu, 15 Jan 2009 11:02:45 +0300
One question was solved. I found a correct keypath to bind my document
on selected filter. It works with "selection.self" keypath.
But my -setFilter method still doesn't get called when I change it's
properties. Maybe it is right, but I need to know when filter's
properties were changed. Do I need to register observer for every
filter that will be set by -setFilter?
On Thu, Jan 15, 2009 at 10:10 AM, Vitaly Ovchinnikov
<email@hidden> wrote:
> Hello all,
>
> I have array of Filter objects in my document. Filters are used in two ways:
> 1. I can select one of them to filter my data
> 2. I can browse them all and add, delete or/*modify any of them
>
> My document exposes this array via -filters/-setFilters pair. I have
> two NSArrayControllers: one for the first task and another for the
> second task.
>
> Main window has NSPopUpButton that is bound to the first array
> controller. It is used to select filter. Window controller receives
> messages from this button and call -setFilter method of my document.
> Document filters data and all works fine, but I think there is a
> simpler way to "connect" my document's -filter property and to
> controller's selection. Is it possible? This is the first question.
>
> Other array controller used for editing filters. I have NSTableView
> bound to that controller that shows filter names and NSPredicateEditor
> that is bound to selection of the second array controller. It is used
> to edit filter.
>
> All works fine, but I can't receive a notify that current filter was
> changed. NSPopUpButton somehow knows that name of filter was changed
> and displays it immediately. But my document's -setFilter method
> didn't get called. -setFilters method didn't get called too.
>
> I tried to bind "filter" property of my document to the first
> controller's selection but it didn't work too. I wrote something like
> this in the main window controller:
> [[self document] bind:@"filter" toObject:pFiltersController1
> withKeyPath:@"selection" options:nil]
> I even added +initialize method to the document and exposed "filter"
> binding. Nothing... Just some errors in log about
> "NSControllerObjectProxy predicate: unrecognized selector sent to
> instance ......"
>
> So the questions are:
> 1. How to bind some property of my document to selected object of
> NSArrayController? Or at least how to monitor changes of the selected
> object?
> 2. What is the correct way to do what I want (two different types of
> operations on one array)?
> Thank you.
>
_______________________________________________
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