O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSComboBoxDataSource — Mac OS X 10.0

Synopsis

This informal protocol provides methods for a class to implement to act as a data source for NSComboBox objects. This protocol declares methods that not only provide the contents of the combo box list, but support autocompletion behavior (where a string is returned from the data source that matches a partially completed string typed into the combo box field). At a minimum, data source objects must implement the methods comboBox:objectValueForItemAtIndex: and numberOfItemsInComboBox:.

@interface NSObject (NSComboBoxDataSource)
                                  // Instance Methods
   - (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
   - (id)comboBox:(NSComboBox *)aComboBox 
                                 objectValueForItemAtIndex:(int)index;
   - (unsigned int)comboBox:(NSComboBox *)aComboBox 
                                 indexOfItemWithStringValue:(NSString *)string;
   - (NSString *)comboBox:(NSComboBox *)aComboBox 
                                 completedString:(NSString *)string;
@end

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required