To close this topic. I decided to use token field instead of popup
button to allow selection of more than one tag. I subclassed
NSPredicateEditorRowTemplate and now it matches predicates like "ANY
Tags IN {tag1, tag2, tag3}". It works relatively fine.

Thanks to all

On Thu, Jan 29, 2009 at 10:48 AM, Vitaly Ovchinnikov
<vitaly.ovchinni...@gmail.com> wrote:
> 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 (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