Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NSPopUpButtonMBS.addItemsWithTitles(titles() as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Adds multiple items to the end of the menu.
Notes:
temTitles: 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.

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

Since 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. Add items directly to the receiver's menu instead.

Feedback, Comments & Corrections

NSPopUpButtonMBS.addItemWithTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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 menu-item entry. If an item with the same title already exists in the menu, the existing item is removed and the new one is added.

If you want to move an item, it's better to invoke removeItemWithTitle explicitly and then send this method. After adding the item, this method calls the synchronizeTitleAndSelectedItem method to make sure the item being displayed matches the currently selected item.

Since 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. Add items directly to the receiver's menu instead.

Feedback, Comments & Corrections

NSPopUpButtonMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Creates a new button with size 100/100 and position 0/0
Example:
dim t as new NSPopUpButtonMBS
Notes: On success the handle property is not zero.

See also:

Feedback, Comments & Corrections

NSPopUpButtonMBS.Constructor(Handle as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.3 Yes No No Yes, macOS only No
Function: Creates an object based on the given NSPopUpButton handle.
Example:
dim t as new NSPopUpButtonMBS(0, 0, 100, 100)
dim v as new NSPopUpButtonMBS(t.handle)

MsgBox str(v.Bounds.Width)+" x "+str(v.Bounds.Height)
Notes: The handle is casted to a NSPopUpButton and the plugin retains this handle.

See also:

Feedback, Comments & Corrections

NSPopUpButtonMBS.Constructor(left as Double, top as Double, width as Double, height as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Creates a new popup button with the given size and position.
Example:
dim x as new NSPopUpButtonMBS(0, 0, 100, 100)
Notes: On success the handle property is not zero.

See also:

Feedback, Comments & Corrections

NSPopUpButtonMBS.Constructor(left as Double, top as Double, width as Double, height as Double, pullsDown as boolean)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Creates an NSPopUpButton object initialized to the specified dimensions.
Notes:
left,top,width,height: The frame rectangle for the button, specified in the parent view's coordinate system.

pullsDown: true if you want the receiver to display a pull-down menu; otherwise, false if you want it to display a pop-up menu.

See also:

Feedback, Comments & Corrections

NSPopUpButtonMBS.indexOfItem(item as NSMenuItemMBS) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.
This method invokes the method of the same name of its NSPopUpButtonCell object.

Feedback, Comments & Corrections

NSPopUpButtonMBS.indexOfItemWithTag(tag as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

This method invokes the method of the same name of its NSPopUpButtonCell object.

Feedback, Comments & Corrections

NSPopUpButtonMBS.indexOfItemWithTitle(title as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

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

Feedback, Comments & Corrections

NSPopUpButtonMBS.indexOfSelectedItem as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Returns the index of the item last selected by the user.
Notes: The index of the selected item, or -1 if no item is selected.

Feedback, Comments & Corrections

NSPopUpButtonMBS.insertItemWithTitle(title as string, atIndex as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

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

Since 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. Add items directly to the receiver's menu instead.

Feedback, Comments & Corrections

NSPopUpButtonMBS.itemAtIndex(index as Integer) as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

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

Feedback, Comments & Corrections

NSPopUpButtonMBS.itemWithTitle(title as string) as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

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

Feedback, Comments & Corrections

NSPopUpButtonMBS.lastItem as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Returns the last item in the menu.

Feedback, Comments & Corrections

NSPopUpButtonMBS.removeAllItems
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Removes all items in the receiver's item menu.
Notes: After removing the items, this method uses the synchronizeTitleAndSelectedItem method to refresh the menu.

Feedback, Comments & Corrections

NSPopUpButtonMBS.removeItemAtIndex(index as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

After removing the item, this method uses the synchronizeTitleAndSelectedItem method to make sure the title displayed matches the currently selected item.

Feedback, Comments & Corrections

NSPopUpButtonMBS.removeItemWithTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

This method removes the first item it finds with the specified name. This method then uses synchronizeTitleAndSelectedItem to refresh the menu.

Feedback, Comments & Corrections

NSPopUpButtonMBS.selectedItem as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Returns the menu item last selected by the user.
Notes:
Returns the menu item that is currently selected, or nil if no item is selected.

The last selected menu item is the one that was highlighted when the user released the mouse button. It is possible for a pull-down menu's selected item to be its first item.
(Read and Write computed property)

Feedback, Comments & Corrections

NSPopUpButtonMBS.selectItem(item as NSMenuItemMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

Feedback, Comments & Corrections

NSPopUpButtonMBS.selectItemAtIndex(index as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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.

Feedback, Comments & Corrections

NSPopUpButtonMBS.selectItemWithTag(tag as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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 setTag: method of NSMenuItem.

Available in Mac OS X v10.4 and later.

Feedback, Comments & Corrections

NSPopUpButtonMBS.selectItemWithTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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 an empty string, or a string that does not match the title of a menu item, this method deselects the currently selected item.

Feedback, Comments & Corrections

NSPopUpButtonMBS.setTitle(title as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 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: If the receiver displays a pop-up menu, this method changes the current item to be the item with the specified title, adding a new item by that name if one does not already exist. If the receiver displays a pull-down list, this method sets its title to the specified string.

Feedback, Comments & Corrections

NSPopUpButtonMBS.synchronizeTitleAndSelectedItem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Ensures that the item being displayed by the receiver agrees with the selected item.
Notes: If there's no selected item, this method selects the first item in the item menu and sets the receiver's item to match. For pull-down menus, this method makes sure that the first item is being displayed (the NSPopUpButtonCell object must be set to use the selected menu item, which happens by default).

Feedback, Comments & Corrections

NSPopUpButtonMBS.titleOfSelectedItem as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Controls MBS CocoaControls Plugin 10.0 Yes No No Yes, macOS only No
Function: Returns the title of the item last selected by the user.
Notes: Returns the title of the selected menu item, or an empty string if no item is selected.

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins