Le 26 nov. 08 à 04:57, Steve Steinitz a écrit :

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?

I'm not sure but did you try :

[searchfield validateEditing];

- (void)validateEditing

Discussion
Validation sets the object value of the cell to the current contents of the cell’s editor (the NSTextobject used for editing), storing it as a simple NSString or an attributed string object based on the attributes of the editor.

Frédéric_______________________________________________

Cocoa-dev mailing list ([email protected])

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