Programatically Triggering an NSSearchField Search
Programatically Triggering an NSSearchField Search
- Subject: Programatically Triggering an NSSearchField Search
- From: Steve Steinitz <email@hidden>
- Date: Wed, 26 Nov 2008 14:57:17 +1100
Hello,
I use NSSearchFields bound to NSArrayControllers to allow my
client to search their Core Data database. Pretty standard. My
search predicate bindings are lengthy, giving my client lots of
options to find what they want.
Occasionally I would like to programmatically specify a search
for them. For example, I was able to programmatically clear
their search fields like this:
[searchfield setStringValue: @""];
[arrayController setFilterPredicate: nil];
However I can't work out how to set the correct non-nil
predicate. Actually, I don't want to set the predicate --
that's already done nicely in the bindings and I don't want to
duplicate it in the code, for maintenance reasons. ** I just
want to put something in the search field and make it 'do it' **
I've tried increasingly desperate ideas to 'do' the search
string. Here is my most recent defeat - sad, perhaps comical:
[searchfield setStringValue: @"10471"];
[arrayController setFilterPredicate: [arrayController
filterPredicate]]; // :)
(How) can I just trigger the search after setting the
NSSearchField's value?
Thanks,
Steve
_______________________________________________
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