Using Automatic Completion in Combo Boxes
A combo box can perform automatic completion, trying to complete what the user enters into the text field with an item from the pop-up list. If it does, every time the user enters characters at the end of the text field, the combo box calls the NSComboBoxCell method
completedString: returns a string that’s longer than the existing string, the combo box replaces the existing string with the returned string, and selects the additional characters. If the user adds characters somewhere besides the end of the string or deletes characters, the combo box does not try to complete it.
The default implementation of
completedString: first checks whether the combo box uses a data source and whether the data source responds to
comboBoxCell:completedString:. If so, the combo box cell returns that method’s return value. Otherwise, this method goes through the combo box’s items one-by-one and returns the first item which starts with the string that the user entered. This comparison is case-sensitive.
To read and set whether a combo box performs completion, use
setCompletes:. By default, it does not.