On 7 May 2009, at 13:54, Jon C. Munson II wrote:

Namaste!

I tried searching for the answers to hopefully avoid having to ask, however,
I am drawing blanks...

I could use a little more explanation of what you wrote. For my benefit, and for those who are new to this as well, would you mind answering the
following:

1. Please explain the difference/purpose between the strings assigned to search1 & search2 as the terms therein are different from what I see in IB
(aside from contains[cd] of course).
These are your NSPredicate format strings. The NSPredicate docs have the low down on this.
IB just separates the binding options out for you.
Here we fashion an NSDictionary of our required binding options and pass it into our binding method.

NSString *search2 = @"(messageStringValue CONTAINS[cd] $value)";
In this case my model has a property named messageStringValue.

2.  What do "All and "Entry" mean in this context?
These are my display names identified by the NSDisplayNameBindingOption key.


2a.  To configure predicates 1..n, which of those terms would one use?
Just establish as many predicate bindings as you need.
Read the NSSearchField bindings ref for predicate.

Guess I'll start with that...

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

-----Original Message-----
From: cocoa-dev-bounces+jmunson=his....@lists.apple.com [mailto:cocoa-dev-
bounces+jmunson=his....@lists.apple.com] On Behalf Of Jon C. Munson II
Sent: Thursday, May 07, 2009 8:19 AM
To: jonat...@mugginsoft.com
Cc: cocoa-dev@lists.apple.com
Subject: RE: Programmatic access to NSSearchField's Display Name?

Namaste!

Thanks!

Too bad there isn't any way to access "the list" otherwise... I read
something about that not being possible due to a copy not being made...

So, where did you find this stuff? I looked in the docs and didn't any of
that referenced from the perspective of the search field.

Peace, Love, and Light,

/s/ Jon C. Munson II

-----Original Message-----
From: jonat...@mugginsoft.com [mailto:jonat...@mugginsoft.com]
Sent: Thursday, May 07, 2009 3:14 AM
To: jmun...@his.com
Cc: cocoa-dev@lists.apple.com
Subject: Re: Programmatic access to NSSearchField's Display Name?


On 6 May 2009, at 22:43, jmun...@his.com wrote:

Namaste!

Is there a way to programmatically access the Display Name attribute
of the search field for a given predicate?

I've got a number of predicates set up via IB and several of them I
need to be able to change the display name at run time.


If you create your searchField bindings manually rather than in IB
then you can recreate them as and when you require with specific
display names:

        NSString *search1 =  @"(unitName CONTAINS[cd] $value OR
unitPluralName CONTAINS[cd] $value)";
        NSString *search2 = @"(messageStringValue CONTAINS[cd] $value)";

        // search all
        NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:

NSLocalizedString(@"All",
@"Search field placeholder"),
NSDisplayNameBindingOption,
                                                         search1,
NSPredicateFormatBindingOption,
                                                         nil];
        [self.searchField bind:NSPredicateBinding

toObject:entryController

withKeyPath:@"filterPredicate"
                                                        options: options];

Note that searchField exposes additional bindings every time you bind
a predicate. so the next binding requires a suffix to
NSPredicateBinding.

        // search entry
        options = [NSDictionary dictionaryWithObjectsAndKeys:

NSLocalizedString(@"Entry",
@"Search field placeholder"),
NSDisplayNameBindingOption,
                                                         search2,
NSPredicateFormatBindingOption,
                                                         nil];

        [self.searchField bind:[NSPredicateBinding
stringByAppendingString:@"2"]

toObject:entryController

withKeyPath:@"filterPredicate"
                                                        options: options];

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

_______________________________________________

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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.com

Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




_______________________________________________

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/jmunson%40his.com

This email sent to jmun...@his.com

_______________________________________________

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/developer%40mugginsoft.com

This email sent to develo...@mugginsoft.com

_______________________________________________

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