(informal protocol)
Framework | /System/Library/Frameworks/AppKit.framework |
Companion guide | |
Declared in | NSComboBoxCell.h |
The NSComboBoxCellDataSource
category declares the methods that an NSComboBoxCell
uses to access the contents of its data source object.
For more information, see “Providing Data for a Combo Box”.
Returns the item from the combo box's pop-up list that matches the text entered by the user.
- (NSString *)comboBoxCell:(NSComboBoxCell *)aComboBoxCell completedString:(NSString *)uncompletedString
The combo box cell.
The substring containing the text the user typed into the text field of the combo box cell.
The completed string, from the items in the pop-up list, that matches the text entered by the user. Your implementation should return the first complete string that starts with uncompletedString.
An NSComboBoxCell
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.
NSComboBoxCell.h
Invoked by an NSComboBoxCell
object to synchronize the pop-up list’s selected item with the text field’s contents.
- (NSUInteger)comboBoxCell:(NSComboBoxCell *)aComboBoxCell indexOfItemWithStringValue:(NSString *)aString
The combo box cell.
The string to match. If comboBoxCell:completedString:
is implemented, aString is the string returned by that method. Otherwise, aString is the text that the user has typed.
The index for the pop-up list item matching aString, or NSNotFound
if no item matches.
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.
NSComboBoxCell.h
Returns the object that corresponds to the item at the given index in the combo box cell.
- (id)comboBoxCell:(NSComboBoxCell *)aComboBoxCell objectValueForItemAtIndex:(NSInteger)index
The combo box cell for which to return the item.
The index of the item to return.
The object corresponding to the item at the specified index in the given combo box cell.
Your data source must implement this method.
NSComboBoxCell.h
Returns the number of items managed for the combo box cell by your data source object.
- (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)aComboBoxCell
The combo box cell for which your data source manages items.
The number of items your data source object manages.
An NSComboBoxCell
object uses this method to determine how many items it should display in its pop-up list. Your data source must implement this method.
NSComboBoxCell.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)