NSPredicateEditorRowTemplate and NSTokenField
NSPredicateEditorRowTemplate and NSTokenField
- Subject: NSPredicateEditorRowTemplate and NSTokenField
- From: Vitaly Ovchinnikov <email@hidden>
- Date: Fri, 30 Jan 2009 11:21:18 +0300
Hello all, that's me again with my predicate editor problems :)
I subclassed predicate editor's row and replaced default text editor
with my NSTokenField in -templateViews.
Predicates, that match my template, look like: ANY Tags IN {"tag1",
"tag2", "tag3"}
In -setPredicate I fill token field with tags from predicate:
NSExpression *right = .....;
[pMyTokenField setObjectValue:[right constantValue]];
In -predicateWithSubPredicates I create predicate described above with
right part from my token field. I added traces there and it builds
exactly what I need.
Now, the problem: I added observer to the predicate that I edit and it
gets called at every change of predicate, but not for my token field
template!
Predicate editor has several rows, some of them are "standard" -
numeric, text etc. If I change any of them - my observer gets called.
If I edit my token field, observer doesn't get called at all. If I add
some token and switch focus to another row, predicate editor calls
-predicateWithSubPredicate, I build correct predicate and... nothing.
Observer doesn't get called. If I press "Enter" after adding token -
observer will be called. If I switch to some other row (not with my
template) and then switch back - observer will be called. If I switch
to another row with the same template and when switch back - observer
will not be called.
I added one more control to the row - a button. It does nothing, just
takes some place. I can change my token fields and observer will not
be called. But if I press this button - observer will be called
immediately.
I tried to override -rightExpressions method and return my list of
tags, I tried to call -will/didChangeValueForKey: - nothing helped. It
seems that I need to notify somebody about the change, but have no
idea - how to do that?
Please, help me :)
P.S.: Things are a bit more complex, I have Filter objects, that hold
predicates. Predicate editor is bound to the filter and my observer
observes those filters, not the predicates themselves. I tell this to
cut ideas about incorrect observing. Observing works perfect for any
other row.
_______________________________________________
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