Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

NSPopUpButtonCellMBS.addItemsWithTitles(itemTitles() as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Adds multiple items to the end of the menu.
Notes:
itemTitles: An array of strings containing the titles of the items you want to add. Each string in the array should be unique. If an item with the same title already exists in the menu, the existing item is removed and the new one is added.

The new menu items use the pop-up button’s default action and target, but you can change these using the setAction: and setTarget: methods of the corresponding NSMenuItem object.

If you want to move an item, it’s better to invoke removeItemWithTitle: explicitly and then call this method. After adding the items, this method uses the synchronizeTitleAndSelectedItem method to make sure the item being displayed matches the currently selected item.

Because this method searches for duplicate items, it should not be used if you are adding items to an already populated menu with more than a few hundred items. In a situation like this, add items directly to the receiver's menu instead.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.addItemWithTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Adds an item with the specified title to the end of the menu.
Notes:
title: The title of the new menu item. If an item with the same title already exists in the menu, the existing item is removed and the new one is added.

The menu item uses the pop-up button’s default action and target, but you can change these using the setAction: and setTarget: methods of the corresponding NSMenuItemMBS object.
Because this method searches for duplicate items, it should not be used if you are adding an item to an already populated menu with more than a few hundred items. In a situation like this, add items directly to the button's menu instead.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.Constructor(image as NSImageMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: The private constructor.

See also:

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.Constructor(text as string, pullsDown as boolean)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns an NSPopUpButtonCell object initialized with the specified title.

See also:

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.dismissPopUp
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Dismisses the pop-up button’s menu by ordering its window out.
Notes:
If the pop-up button was not displaying its menu, this method does nothing.
You normally do not call this method explicitly. It is called by the Application Kit automatically to dismiss the menu for the pop-up button.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.indexOfItem(item as NSMenuItemMBS) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns the index of the specified menu item.
Notes:
item: The menu item whose index you want.

Returns the index of the item or -1 if no such item was found.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.indexOfItemWithTag(tag as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns the index of the menu item with the specified tag.
Notes:
tag: The tag of the menu item you want.

Returns the index of the item or -1 if no item with the specified tag was found.

Tags are values your application assigns to an object to identify it. You can assign tags to menu items using the tag property of NSMenuItemMBS.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.indexOfItemWithTitle(title as String) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns the index of the item with the specified title.
Notes:
title: The title of the item you want. You must not pass nil for this parameter.

Returns the index of the item or -1 if no item with the specified title was found.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.insertItemWithTitle(title as string, atIndex as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Inserts an item at the specified position in the menu.
Notes:
title: The title of the new item. If an item with the same title already exists in the menu, the existing item is removed and the new one is added
index: The zero-based index at which to insert the item. Specifying 0 inserts the item at the top of the menu.

The value in index must represent a valid position in the array. The menu item at index and all those that follow it are shifted down one slot to make room for the new menu item.
This method assigns the pop-up button’s default action and target to the new menu item. This triggers the action event of the NSActionCellMBS.

Because this method searches for duplicate items, it should not be used if you are adding an item to an already populated menu with more than a few hundred items. In a situation like this, add items directly to the button's menu instead.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.itemArray as NSMenuItemMBS()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: An array of NSMenuItemMBS objects that represent the items in the menu.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.itemAtIndex(Index as Integer) as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns the menu item at the specified index.
Notes:
index: The index of the item you want. The specified index must refer to an existing menu item.

Returns the menu item, or nil if no item exists at the specified index.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.itemTitleAtIndex(Index as Integer) as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns the title of the item at the specified index.
Notes:
index: The index of the item you want.

Returns the title of the item, or an empty string if no item exists at the specified index.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.itemTitles as String()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: An array of strings containing the titles of every item in the menu.
Notes: The titles appear in the order in which the items appear in the menu. If the menu contains separator items, the array contains an empty string ("") for each separator item.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.itemWithTitle(title as String) as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Returns the menu item with the specified title.
Notes:
title: The title of the menu item you want.

Returns the menu item, or nil if no item with the specified title exists in the menu.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.removeAllItems
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Removes all items in the receiver’s item menu.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.removeItemAtIndex(Index as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Removes the item at the specified index.
Notes: index: The zero-based index indicating which item to remove. Specifying 0 removes the item at the top of the menu. The index must be valid and non-negative.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.removeItemWithTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Removes the item with the specified title from the menu.
Notes: title: The title of the item you want to remove. If no menu item exists with the specified title, this method triggers an assertion.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.selectItem(item as NSMenuItemMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Selects the specified menu item.
Notes:
item: The menu item to select, or nil if you want to deselect all menu items.

By default, selecting or deselecting a menu item from a pop-up menu changes its state. Selecting a menu item from a pull-down menu does not automatically alter the state of the item. To disassociate the current selection from the state of menu items, set the altersStateOfSelectedItem property to NO.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.selectItemAtIndex(Index as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Selects the item in the menu at the specified index.
Notes:
index: The index of the item you want to select, or -1 you want to deselect all menu items.

By default, selecting or deselecting a menu item from a pop-up menu changes its state. Selecting a menu item from a pull-down menu does not automatically alter the state of the item. To disassociate the current selection from the state of menu items, set the altersStateOfSelectedItem property to false.
Subclassers can override this method to catch all select calls.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.selectItemWithTag(tag as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Selects the menu item with the specified tag.
Notes:
tag: The tag of the item you want to select.

Returns true if the item was successfully selected; otherwise, false.

If no item with the specified tag is found, this method returns false and leaves the menu state unchanged.
You typically assign tags to menu items from Interface Builder, but you can also assign them programmatically using the tag property of NSMenuItemMBS.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.selectItemWithTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Selects the item with the specified title.
Notes:
title: The title of the item to select. If you specify nil, an empty string, or a string that does not match the title of a menu item, this method deselects the currently selected item.

By default, selecting or deselecting a menu item changes its state. To disassociate the current selection from the state of menu items, set the altersStateOfSelectedItem property to false.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.setTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Sets the string displayed in the receiver when the user isn’t pressing the mouse button.
Notes:
title: The string to display.

For pull-down menus that get their titles from a menu item, this method simply sets the pop-up button cell’s menu item to the first item in the menu. For pop-up menus, if a menu item whose title matches aString exists, this method makes that menu item the current selection; otherwise, it creates a new menu item with the title aString, adds it to the pop-up menu, and selects it.

Feedback, Comments & Corrections

NSPopUpButtonCellMBS.synchronizeTitleAndSelectedItem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS MacCocoa Plugin 17.1 Yes No No Yes, macOS only No
Function: Synchronizes the the pop-up button’s displayed item with the currently selected menu item.
Notes:
If no item is currently selected, this method synchronizes the pop-up buttons displayed item with the first menu item. If the pop-up button cell does not get its displayed item from a menu item, this method does nothing.
For pull-down menus, this method sets the displayed item to the title first menu item.
If the pop-up button’s menu does not contain any menu items, this method sets the pop-up button’s displayed item to nil, resulting in nothing being displayed in the control.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCocoa Plugin.





Links
MBS Xojo tutorial videos