Up

# NSPopUpButton

### Authors

Scott Christley (`scottc@net-community.com`)
Michael Hanni (`mhanni@sprintmail.com`)

> Popup list class

Copyright: (C) 1996 Free Software Foundation, Inc.

# Software documentation for the NSPopUpButton class

## NSPopUpButton : NSButton

> Declared in:
>   AppKit/NSPopUpButton.h

Availability: OpenStep
Description forthcoming.
Method summary

- -addItemWithTitle:
- -addItemsWithTitles:
- -autoenablesItems
- -indexOfItem:
- -indexOfItemWithRepresentedObject:
- -indexOfItemWithTag:
- -indexOfItemWithTarget:andAction:
- -indexOfItemWithTitle:
- -indexOfSelectedItem
- -initWithFrame:pullsDown:
- -insertItemWithTitle:atIndex:
- -itemArray
- -itemAtIndex:
- -itemTitleAtIndex:
- -itemTitles
- -itemWithTitle:
- -lastItem
- -numberOfItems
- -preferredEdge
- -pullsDown
- -removeAllItems
- -removeItemAtIndex:
- -removeItemWithTitle:
- -selectItem:
- -selectItemAtIndex:
- -selectItemWithTag:
- -selectItemWithTitle:
- -selectedItem
- -setAutoenablesItems:
- -setPreferredEdge:
- -setPullsDown:
- -setTitle:
- -synchronizeTitleAndSelectedItem
- -titleOfSelectedItem

### addItemWithTitle:

- (void) addItemWithTitle: (NSString*)title;
Availability: OpenStep

Inserts a new item with title as its title at the end of the list and synchronizes the NSPopUpButton's title with the title of the selected item.

See Also: [NSPopUpButtonCell -addItemWithTitle:] -synchronizeTitleAndSelectedItem

### addItemsWithTitles:

- (void) addItemsWithTitles: (NSArray*)itemTitles;
Availability: OpenStep

Inserts a new list of items with titles as titles at the end of the list and synchronizes the NSPopUpButton's title with the title of the selected item.

See Also: [NSPopUpButtonCell -addItemsWithTitles:] -synchronizeTitleAndSelectedItem

### autoenablesItems

- (BOOL) autoenablesItems;
Availability: OpenStep
Description forthcoming.

### indexOfItem:

- (int) indexOfItem: (id<NSMenuItem>)anObject;
Availability: OpenStep
Description forthcoming.

### indexOfItemWithRepresentedObject:

- (int) indexOfItemWithRepresentedObject: (id)anObject;
Availability: OpenStep
Description forthcoming.

### indexOfItemWithTag:

- (int) indexOfItemWithTag: (int)tag;
Availability: OpenStep

Returns the index of the item with tag as its tag. Returns -1 if the cell is not found

See Also: [NSPopUpButtonCell -indexOfItemWithTag:] -indexOfItemWithTitle: -indexOfItemWithRepresentedObject:

### indexOfItemWithTarget: andAction:

- (int) indexOfItemWithTarget: (id)target andAction: (SEL)actionSelector;
Availability: OpenStep
Description forthcoming.

### indexOfItemWithTitle:

- (int) indexOfItemWithTitle: (NSString*)title;
Availability: OpenStep

Returns the index of the item with title as its title. Returns -1 if the cell is not found

See Also: [NSPopUpButtonCell -indexOfItemWithTitle:] -indexOfItemWithTag: -indexOfItemWithRepresentedObject:

### indexOfSelectedItem

- (int) indexOfSelectedItem;
Availability: OpenStep

Returns the index of the selected item

See Also: [NSPopUpButtonCell -indexOfSelectedItem]

### initWithFrame: pullsDown:

- (id) initWithFrame: (NSRect)frameRect pullsDown: (BOOL)flag;
Availability: OpenStep

Initialize and returns a new NSPopUpButton into the frame frameRect and specified by flag if the NSPopUpButton is a pull-down list

See Also: -setPullsDown: [NSView -initWithFrame:]

### insertItemWithTitle: atIndex:

- (void) insertItemWithTitle: (NSString*)title atIndex: (int)index;
Availability: OpenStep

Inserts a new item with title as its title at the specified index and synchronizes the NSPopUpButton's title with the title of the selected item.

See Also: [NSPopUpButtonCell -insertItemWithTitle:atIndex:] -synchronizeTitleAndSelectedItem

### itemArray

- (NSArray*) itemArray;
Availability: OpenStep
Description forthcoming.

### itemAtIndex:

- (id<NSMenuItem>) itemAtIndex: (int)index;
Availability: OpenStep

Returns the NSMenuItem at index index or `nil` if index is out of range

See Also: [NSPopUpButtonCell -itemAtIndex:]

### itemTitleAtIndex:

- (NSString*) itemTitleAtIndex: (int)index;
Availability: OpenStep

Returns the item's title at index index

### itemTitles

- (NSArray*) itemTitles;
Availability: OpenStep

Returns an array containing the items's titles

### itemWithTitle:

- (id<NSMenuItem>) itemWithTitle: (NSString*)title;
Availability: OpenStep

Returns the NSMenuItem with title as its title

### lastItem

- (id<NSMenuItem>) lastItem;
Availability: OpenStep

Returns the last NSMenuItem of the list

### numberOfItems

- (int) numberOfItems;
Availability: OpenStep

Returns the number of items in the item list

See Also: [NSPopUpButtonCell -numberOfItems]

### preferredEdge

- (NSRectEdge) preferredEdge;
Availability: OpenStep
Description forthcoming.

### pullsDown

- (BOOL) pullsDown;
Availability: OpenStep

Returns whether the NSPopUpButton's cell has a pulls-down list (`YES`) or a pop-up list (`NO`)

See Also: -setPullsDown: [NSPopUpButtonCell -pullsDown]

### removeAllItems

- (void) removeAllItems;
Availability: OpenStep

Removes all items from the item list and synchronizes the NSPopUpButton's title with the title of the selected

See Also: [NSPopUpButtonCell -removeAllItems] -removeItemWithTitle: -synchronizeTitleAndSelectedItem

### removeItemAtIndex:

- (void) removeItemAtIndex: (int)index;
Availability: OpenStep

Removes the item at the specified index index from the item list and synchronizes the NSPopUpButton's title with the title of the selected

See Also: [NSPopUpButtonCell -removeItemAtIndex:] -removeAllItems -removeItemWithTitle: -synchronizeTitleAndSelectedItem

### removeItemWithTitle:

- (void) removeItemWithTitle: (NSString*)title;
Availability: OpenStep

Removes the item specified with title as its title from the item list and synchronizes the NSPopUpButton's title with the title of the selected

See Also: [NSPopUpButtonCell -removeItemWithTitle:] -removeAllItems -removeItemAtIndex: -synchronizeTitleAndSelectedItem

### selectItem:

- (void) selectItem: (id<NSMenuItem>)anObject;
Availability: OpenStep
Description forthcoming.

### selectItemAtIndex:

- (void) selectItemAtIndex: (int)index;
Availability: OpenStep

Select the item at index index and synchronizes the NSPopUpButton's title with the title of the selected

See Also: [NSPopUpButtonCell -selectItemAtIndex:] -synchronizeTitleAndSelectedItem

### selectItemWithTag:

- (BOOL) selectItemWithTag: (NSInteger)tag;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### selectItemWithTitle:

- (void) selectItemWithTitle: (NSString*)title;
Availability: OpenStep

Select the item with title title and synchronizes the NSPopUpButton's title with the title of the selected

See Also: [NSPopUpButtonCell -selectItemWithTitle:] -synchronizeTitleAndSelectedItem

### selectedItem

- (id<NSMenuItem>) selectedItem;
Availability: OpenStep

Returns the selected item

See Also: [NSPopUpButtonCell -selectedItem]

### setAutoenablesItems:

- (void) setAutoenablesItems: (BOOL)flag;
Availability: OpenStep
Description forthcoming.

### setPreferredEdge:

- (void) setPreferredEdge: (NSRectEdge)edge;
Availability: OpenStep
Description forthcoming.

### setPullsDown:

- (void) setPullsDown: (BOOL)flag;
Availability: OpenStep

Sets whether the NSPopUpButton's cell has a pulls-down list (`YES`) or a pop-up list (`NO`)

See Also: -pullsDown [NSPopUpButtonCell -setPullsDown:]

### setTitle:

- (void) setTitle: (NSString*)aString;
Availability: OpenStep
Description forthcoming.

### synchronizeTitleAndSelectedItem

- (void) synchronizeTitleAndSelectedItem;
Availability: OpenStep
Description forthcoming.

### titleOfSelectedItem

- (NSString*) titleOfSelectedItem;
Availability: OpenStep

Returns the title of the selected item

See Also: [NSPopUpButtonCell -titleOfSelectedItem]

Up