I'm assuming your nav aids list will have an array controller and that you're building for Tiger or better.

You really shouldn't. A number of reasons for this presented themselves on this very list within the last few weeks.

You can get the search behavior by adding a search field to your interface and binding the search field's predicate to the array controller's filterPredicate. It will then filter your array of nav aids in real time, and there's no code necessary -- it's all done in IB.

This is absolutely true, but a warning: it requires a good, solid understanding of the most basic Cocoa design patterns, as well as some moderately-advanced topics like Key-Value Coding (KVC) and Key-Value Observing (KVO), so you can grasp the Bindings mechanism (upon which NSArrayController relies). If you don't have this foundation, you're in for a world of hurt going down this path prematurely.

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pUsing.html

Thankfully, predicates work just fine without Bindings. If you have a good understanding of KVC, you can filter an array and use the approach Nick Zitzmann previously suggested.

Well, with one minor adjustment. Use the -[NSControl controlTextDidChange:] delegate method instead of a timer. Trigger your filtration each time it's called by your search field.

--
I.S.


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to