View Full Version : autocompletion of NSTextField
Apr 10, 2008, 05:23 AM
I want to autocompletion of NstextField from dropdown list ...... just like the Apple Mail "new Message" does by suggesting the email ids
Apr 10, 2008, 06:49 AM
You will need to change you text field to an instance of NSComboBox. Then, create your NSArray (or of course mutable array) of strings, and send it to the combo box like this:
If you want to sort the list alphabetically, you do it like this:
Obviously do that before using the addItemsWithObjects method above.
To clear the list of completions in a combo box, use this method:
Hope that helps.
Apr 10, 2008, 07:18 AM
Let me make it clear ... there is 1 nstextfiled where user will type the value ......
as soon as he starts typing , suggestions will appear in dropdowns list ... usr can select any matching suggestion or he will continue typing .. as typing continues .... drop down list will change ..... .
Same like apple Mail as i mentioned earlier ....
Anyways , Thanks for your Help :)
Apr 10, 2008, 08:04 AM
Use an NSTextView instead which has lots of methods to override (or delegate methods if you don't want a custom subclass) for autocompletion. See the documentation (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextView_Class/Reference/Reference.html) under Text Completion.