Class

NSPopUpButtonCell

The NSPopUpButtonCell class defines the visual appearance of pop-up buttons that display pop-up or pull-down menus. Pop-up menus present the user with a set of choices, much the way radio buttons do, but using much less space. Pull-down menus also provide a set of choices but present the information in a slightly different way, usually to provide a set of commands from which the user can choose.

Declaration

@interface NSPopUpButtonCell : NSMenuItemCell

Overview

The NSPopUpButtonCell class implements the user interface for the NSPopUpButton class.

Changes made to a menu (such as adding, removing, or changing the items) are not apparent while the menu is being displayed or interacted with.

Topics

Initialization

- initTextCell:pullsDown:

Returns an NSPopUpButtonCell object initialized with the specified title.

Accessing menu attributes

menu

The pop-up button’s associated menu.

pullsDown

A Boolean value that indicates the behavior of the button’s menu.

autoenablesItems

A Boolean value that indicates if the button automatically enables and disables its items every time a user event occurs.

preferredEdge

The edge of the cell from which the menu should pop out when screen conditions are restrictive.

usesItemFromMenu

A Boolean value that indicates if the control uses an item from the menu for its own title.

altersStateOfSelectedItem

A Boolean value that indicates if the pop-up button links the state of the selected menu item to the current selection.

arrowPosition

The position of the arrow displayed on the button.

Adding and removing items

- addItemWithTitle:

Adds an item with the specified title to the end of the menu.

- addItemsWithTitles:

Adds multiple items to the end of the menu.

- insertItemWithTitle:atIndex:

Inserts an item at the specified position in the menu.

- removeItemWithTitle:

Removes the item with the specified title from the menu.

- removeItemAtIndex:

Removes the item at the specified index.

- removeAllItems

Removes all items in the receiver’s item menu.

Accessing the items

itemArray

An array of NSMenuItem objects that represent the items in the menu.

numberOfItems

The number of items in the menu.

- indexOfItem:

Returns the index of the specified menu item.

- indexOfItemWithTitle:

Returns the index of the item with the specified title.

- indexOfItemWithTag:

Returns the index of the menu item with the specified tag.

- indexOfItemWithRepresentedObject:

Returns the index of the menu item that holds the specified represented object.

- indexOfItemWithTarget:andAction:

Returns the index of the menu item with the specified target and action.

- itemAtIndex:

Returns the menu item at the specified index.

- itemWithTitle:

Returns the menu item with the specified title.

lastItem

The last item in the menu.

- setObjectValue:

Selects the item at a specific index using an object value.

- objectValue

Returns the index of the selected item.

Dealing with selection

- selectItem:

Selects the specified menu item.

- selectItemAtIndex:

Selects the item in the menu at the specified index.

- selectItemWithTag:

Selects the menu item with the specified tag.

- selectItemWithTitle:

Selects the item with the specified title.

- setTitle:

Sets the string displayed in the receiver when the user isn’t pressing the mouse button.

selectedItem

The menu item last selected by the user.

indexOfSelectedItem

The index of the item last selected by the user.

- synchronizeTitleAndSelectedItem

Synchronizes the pop-up button’s displayed item with the currently selected menu item.

Title conveniences

- itemTitleAtIndex:

Returns the title of the item at the specified index.

itemTitles

An array of NSString objects containing the titles of every item in the menu.

titleOfSelectedItem

The title of the item last selected by the user.

Setting the image

- setImage:

This method has no effect.

Handling events and action messages

- attachPopUpWithFrame:inView:

Sets up the receiver to display a menu.

- dismissPopUp

Dismisses the pop-up button’s menu by ordering its window out.

- performClickWithFrame:inView:

Displays the receiver’s menu and track mouse events in it.

Constants

NSPopUpArrowPosition

These constants are defined for use with the arrowPosition property.

Notifications

NSPopUpButtonCellWillPopUpNotification

This notification is posted just before a pop-up menu is attached to its window frame.

Initializers

Relationships

Inherits From