Re: filterPredicate and bindings
Re: filterPredicate and bindings
- Subject: Re: filterPredicate and bindings
- From: Keary Suska <email@hidden>
- Date: Sat, 03 Feb 2007 13:15:37 -0700
- Thread-topic: filterPredicate and bindings
on 2/2/07 7:24 PM, email@hidden purportedly said:
> Despite some serious time with TFM I can't for the life of me figure out
> to just bind a textfield to an arraycontroller and specify the
> textfield's filterPredicate. There seems to no documentation on the
> syntax for this, or how to apply a fetched property or request with a
> predicate built using the predicate bulder the bind property 'value'.
> It seems absolutely opaque.
I suggest looking at this a different way. As I understand, the filter
predicate applies to the NSArrayController, and not the text field. It
simply "filters" the array provided as controller content to provide a
(usually) different array that contains objects that match the filter
criteria. So you are still binding to an array controller that may provide
multiple values, even if the content array has only one object in it.
If you look at the bindings docs closely, you will see that there are only a
certain number of ways that an object can access the content/values of the
controller. Having an understanding these methods, and how bindings works,
would help eliminate your confusion.
That being said, the likely solution is for your NSTextField to bind to the
"selection" controller key. But now you need a selection, which you could
either set programmatically, or if your filter predicate will always derive
an array with only one result object, you may be able to get away with
setting the "avoids empty selection" parameter and have the controller do
the work, but this can vary based on other conditions.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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