bind right part of NSPredicateEditor's row to array of strings
bind right part of NSPredicateEditor's row to array of strings
- Subject: bind right part of NSPredicateEditor's row to array of strings
- From: Vitaly Ovchinnikov <email@hidden>
- Date: Thu, 29 Jan 2009 10:48:58 +0300
Hello all,
Still have problems with predicate editor. My items have tags and I
want to be able to filter items by those tags. My document has array
of all tags, so I added a row template with three popup buttons and
wanted to bind the third one to that array. I tried the following:
NSPopUpButton *pTagsCombo = [[pRowTemplateTags templateViews] objectAtIndex:2];
[pTagsCombo bind:@"contentValues" toObject:self
withKeyPath:@"document.tags" options:0];
but received errors. If I clear "Constant Values" field in IB for that
row, I receive:
In <NSPredicateEditor: 0x1ecf00>, different number of items (2) than
predicate template views (3) for template
<NSPredicateEditorRowTemplate 0x3327120: [Tags] [99] []>
that means that popup is empty. If I add some values to constants
field in IB, I get these:
In <NSPredicateEditor: 0x1e3d50> with template
<NSPredicateEditorRowTemplate 0x3326000: [Tags] [99] []>, we were not
able to find a popup item at view index 2 with title ib_const_1.
Available items are: (
<MenuItem: 0x1935f0 my_real_tag_1>,
<MenuItem: 0x1936f0 my_real_tag_2>,
<MenuItem: 0x193800 my_real_tag_3>
)
To make sure about binding, I added a simple NSPopupButton near the
predicate editor and bound it using the same code - it works fine.
Next idea was that predicate editor clones it's rows and my binding
doesn't work for the clone. I subclassed NSPredicateEdtiorRowTemplate
and override -copyWithZone, so it just retains itself without any
copying. That's not a correct thing, but good enough to make just one
test. This didn't help - I got the same error as before ("we were not
able to find a popup item...").
Now ideas are over and I want to ask you: how the hell can I show a
list of my tags in the right popup?
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