So, if my filter will have ten properties, I should observe them all?
Is it possible to fake this somehow. Like define "self" property that
depends of all my properties and them observe it? Or something like
this...

On Thu, Jan 15, 2009 at 7:19 PM, Keary Suska <cocoa-...@esoteritech.com> wrote:
>
> On Jan 15, 2009, at 1:02 AM, Vitaly Ovchinnikov wrote:
>
>> 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?
>
> -setFilter won't get called if the filter object's properties change. You
> aren't even watching for a property change, just a selection change in an
> NSArrayController. In this case you you may be able to observe the filter's
> properties in -setFilter so if they change you can re-evaulate.
>
> Alternatively, you could have the method that commit the change to a filter
> send a notification that your document listens to, where it re-evaluates the
> filter.
>
> HTH,
>
>> On Thu, Jan 15, 2009 at 10:10 AM, Vitaly Ovchinnikov
>> <vitaly.ovchinni...@gmail.com> 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 (Cocoa-dev@lists.apple.com)
>>
>> 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:
>>
>> http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40esoteritech.com
>>
>> This email sent to cocoa-...@esoteritech.com
>>
>
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to