On Feb 10, 2011, at 8:55 AM, Dave Reed <davel...@mac.com> wrote:

> 
> On Feb 9, 2011, at 9:44 PM, lorenzo7...@gmail.com wrote:
> 
>> I have a NSTableView populated by an NSArrayController. Above the table, I 
>> have an NSToolbar, to which I would like add the ability to search. I have 
>> found a couple of examples of implementing search using an NSSearchField, 
>> but the two that I have found both display the results in a dropdown 
>> attached to the NSSearchField. I would like the table to display the results 
>> live as the user types characters. And when the search field is cleared, the 
>> table should repopulate with the original entries. First, is this even 
>> possible? I can't think of an application that even does this. If so, is 
>> there any sample code that demonstrates this?
>> Thanks
> 
> Yes, it's possible. See the relevant examples here:
> 
> http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
> 
> I think the example there requires you to press <return> in the search field, 
> but it's possible to do with requiring that.
> 
> Dave
> 

Thanks for the reply. But I actually figured it out. I filter the array 
controller using an NSPredicate in controlTextDidChange. I get the filtering I 
need "on the fly". I was able to prevent the dropdown from appearing by 
returning nil in 
control:textView:completions:forPartialWordRange:indexOfSelectedItem:

Works just fine. I hope that's where the example would take me. 
_______________________________________________

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