(Preliminary Documentation) Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSPopUpButton 

Inherits From:	NSButton

Conforms To:	NSCoding
NSObject 

Declared In:	appkit/NSPopUpButton.h 

Initializing a NSPopUpButton 

- (id)initWithFrame:(NSRect)frameRect	Initializes a newly allocated NSPopUpButton, giving it the 
pullsDown:(BOOL)flag		frame specified by frameRect.  If flag is YES, the receiver is initialized to operate as a pull-down list; otherwise, it operates as a pop-up list.

Adding Items 

- (void)addItemWithTitle:(NSString *)title	Adds an item with title as its title to the end of the item list.
- (void)addItemsWithTitles:(NSArray *)itemTitles	Adds multiple items to the end of the item list.  The titles for the new items are taken take from the itemTitles array.
- (void)insertItemWithTitle:(NSString *)title	Inserts an item with title as its title at position index. 
atIndex:(unsigned int)index

Removing Items 

- (void)removeAllItems	Removes all items in the receiver's item list. 
- (void)removeItemWithTitle:(NSString *)title	Removes the item whose title matches title. 
- (void)removeItemAtIndex:(int)index	Removes the item at the specified index.

Querying the NSPopUpButton About Its Items 

- (int)indexOfItemWithTitle:(NSString *)title	Returns the index of the item whose title matches title, or NSNotFound if no match is found.
- (int)indexOfSelectedItem	Returns the index of the item last selected by the user, or NSNotFound if there's no selected item.
- (int)numberOfItems	Returns the number of items in the receiver's item list. 

- (NSMenuCell *)itemAtIndex:(int)index	Returns the NSMenuCell for the item at index, or nil if no such item exists.
- (NSMatrix *)itemMatrix	Returns the NSMatrix that holds the receiver's items.
- (NSString *)itemTitleAtIndex:(int)index	Returns the title of the item at index, or the empty string if no such item exists.
- (NSArray *)itemTitles	Returns an NSArray that holds the titles of the receiver's items.
- (NSMenuCell *)itemWithTitle:(NSString *)title	Returns the NSMenuCell for the item whose title is title, or nil if no such item exists
- (NSMenuCell *)selectedItem	Returns the NSMenuCell for the selected item.
- (NSString *)titleOfSelectedItem	Returns the title of the item last selected by the user, or the empty string if there's no such item.

Manipulating the NSPopUpButton

- (NSFont *)font	Returns the font used to draw the items. 
- (BOOL)pullsDown	Returns YES if the receiver is configured as a pull-down list, and NO if it's configured as a pop-up list.
- (void)selectItemAtIndex:(int)index	Selects the item at index and invokes synchronizeTitleAndSelectedItem.
- (void)selectItemWithTitle:(NSString *)title	Selects the item whose title is title and invokes synchronizeTitleAndSelectedItem.
- (void)setFont:(NSFont *)fontObject	Sets the font used to draw the items.
- (void)setPullsDown:(BOOL)flag	If flag is YES, the receiver is configured as a pull-down list.  If flag is NO, the receiver is configured as a pop-up list.
- (void)setTitle:(NSString *)aString	Adds a new item (if the receiver doesn't already have an item titled aString) and invokes synchronizeTitleAndSelectedItem. 
- (NSString *)stringValue	Returns the title of the selected item.
- (void)synchronizeTitleAndSelectedItem	Ensures that the receiver's title agrees with the title of the selected item (see indexOfSelectedItem).  If there's no selected item, this method selects the first item in the item list and sets the receiver's title to match.  This method is useful in subclasses that directly select items in the item matrix or that override setTitle:.

Displaying the NSPopUpButton's Items 

- (BOOL)autoenablesItems	Returns whether the NSPopUpButton enables and disables its items.  (See the NSMenuActionResponder informal protocol.)
- (void)setAutoenablesItems:(BOOL)flag	Sets whether the NSPopUpButton enables and disables its items.  (See the NSMenuActionResponder informal protocol.)