Class

NSComboBoxCell

The user interface of a combo box.

Declaration

@interface NSComboBoxCell : NSTextFieldCell

Overview

NSComboBoxCell is a subclass of NSTextFieldCell used to implement the user interface of “combo boxes” (see NSComboBox for information on how combo boxes look and work). The NSComboBox subclass of NSTextField uses a single NSComboBoxCell, and essentially all of the NSComboBox class’s methods simply invoke the corresponding NSComboBoxCell method.

Also see the NSComboBoxCellDataSource protocol, which declares the methods that an NSComboBoxCell object uses to access the contents of its data source object.

Topics

Setting Display Attributes

hasVerticalScroller

A Boolean value that indicates if the combo box displays a vertical scroller.

buttonBordered

A Boolean value that indicates whether the combo box button displays a border.

intercellSpacing

The spacing between cells in the combo box’s pop-up list.

itemHeight

The height of each item in the combo box’s pop-up list.

numberOfVisibleItems

The maximum number of items visible in the pop-up list at any one time.

Accessing a Data Source

dataSource

The object that provides the data displayed in the combo box’s pop-up list.

usesDataSource

A Boolean value that indicates if the combo box uses an external data source to populate its pop-up list.

Working with an Internal List

- addItemsWithObjectValues:

Adds multiple objects to the internal item list.

- addItemWithObjectValue:

Adds the specified object to the internal item list.

- insertItemWithObjectValue:atIndex:

Inserts an object at the specified location in the internal item list.

objectValues

The combo box’s internal item list in an array.

- removeAllItems

Removes all items from the combo box’s internal item list.

- removeItemAtIndex:

Removes the object at the specified location from the combo box’s internal item list.

- removeItemWithObjectValue:

Removes all occurrences of the specified object from the combo box’s internal item list.

numberOfItems

The total number of items in the pop-up list.

Manipulating the Displayed List

- indexOfItemWithObjectValue:

Searches the combo box’s internal item list for the given object and returns the matching index number.

- itemObjectValueAtIndex:

Returns the object located at the specified location in the internal item list.

- noteNumberOfItemsChanged

Informs the combo box that the number of items in its data source has changed.

- reloadData

Marks the combo box as needing redisplay, so that it will reload the data for visible pop-up items and draw the new values.

- scrollItemAtIndexToTop:

Scrolls the combo box’s pop-up list vertically so that the item at the given index is as close to the top as possible.

- scrollItemAtIndexToVisible:

Scrolls the combo box’s pop-up list vertically so that the item at the given index is visible.

Manipulating the Selection

- deselectItemAtIndex:

Deselects the pop-up list item at the given index if it’s selected.

indexOfSelectedItem

The index of the last item selected from the pop-up list.

objectValueOfSelectedItem

The object corresponding to the last item selected from the pop-up list.

- selectItemAtIndex:

Selects the pop-up list row at the given index.

- selectItemWithObjectValue:

Selects the first pop-up list item that corresponds to the specified object.

Completing the Text Field

- completedString:

Returns a string from the combo box’s pop-up list that starts with the given substring.

completes

A Boolean value that indicates if the combo box tries to complete text entered by the user.

Relationships

Inherits From