(informal protocol)
Framework | /System/Library/Frameworks/AppKit.framework |
Companion guide | |
Declared in | NSComboBox.h |
The NSComboBoxDataSource
informal protocol declares the methods that an NSComboBox
object uses to access the contents of its data source object.
For more information, see “Providing Data for a Combo Box”.
Returns the first item from the pop-up list that starts with the text the user has typed.
- (NSString *)comboBox:(NSComboBox *)aComboBox completedString:(NSString *)uncompletedString
The combo box.
The string to match against items in the combo box's pop-up list. This is text that the user has typed.
The first complete string from the items in the combo box's pop-up list that starts with the string in uncompletedString.
An NSComboBox
object uses this method to perform incremental—or “smart”—searches when the user types into the text field. As the user types in the text field, the receiver uses this method to search for items from the pop-up list that start with what the user has typed. The receiver adds the new text to the end of the field and selects the new text, so when the user types another character, it replaces the new text.
This method is optional. If you don’t implement it, the receiver does not perform incremental searches.
NSComboBox.h
Returns the index of the combo box item matching the specified string.
- (NSUInteger)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString
The combo box.
The string to match against the items in the combo box. If comboBox:completedString:
is implemented, this is the string returned by that method. Otherwise, it is the text that the user has typed.
The index for the item that matches the specified string, or NSNotFound
if no item matches.
An NSComboBox
object uses this method to synchronize the pop-up list’s selected item with the text field’s contents. This method is optional. If you don’t implement it, the receiver does not synchronize the pop-up list’s selected item with the text field’s contents.
NSComboBox.h
Returns the object that corresponds to the item at the specified index in the combo box.
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index
The combo box.
The index of the item to return.
The object corresponding to the specified index number.
Your data source must implement this method.
NSComboBox.h
Returns the number of items that the data source manages for the combo box.
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox
The combo box.
The number of items that the data source object manages for the specified combo box.
An NSComboBox
object uses this method to determine how many items it should display in its pop-up list. Your data source must implement this method.
NSComboBox.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)