Platforms to show: All Mac Windows Linux Cross-Platform
NSMenuMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa Menus | MBS MacBase Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
All methods in this class will catch exceptions from Cocoa and raise a NSExceptionMBS instead. Using the message, name and reason properties you can see what was the reason for this exception. Please report if you find a method which does not handle exceptions correct.
- 5 events
- event DidClose
- event EnableMenuItems
- event PaletteSelectionChange New in 23.5
- event willHighlightItem(item as NSMenuItemMBS)
- event WillOpen
- 15 properties
- property allowsContextMenuPlugIns as boolean
- property autoenablesItems as Boolean
- property Font as NSFontMBS
- property Handle as Integer
- property highlightedItem as NSMenuItemMBS
- property menuBarHeight as Double
- property minimumWidth as Double
- property numberOfItems as Integer
- property presentationStyle as Integer New in 23.5
- property selectionMode as Integer New in 23.5
- property showsStateColumn as boolean
- property size as NSSizeMBS
- property supermenu as NSMenuMBS
- property Title as String
- property userInterfaceLayoutDirection as Integer
- 21 methods
- method addItem(m as NSMenuItemMBS)
- method cancelTracking
- method cancelTrackingWithoutAnimation
- method Constructor(Handle as Integer)
- method Constructor(title as string="")
- method indexOfItem(item as NSMenuItemMBS) as Integer
- method indexOfItemWithSelector(selector as string) as Integer
- method indexOfItemWithSubmenu(item as NSMenuMBS) as Integer
- method indexOfItemWithTag(tag as Integer) as Integer
- method indexOfItemWithTitle(title as string) as Integer
- method insertItem(m as NSMenuItemMBS, index as Integer)
- method Item(index as Integer) as NSMenuItemMBS
- method itemWithSelector(selector as string) as NSMenuItemMBS
- method performActionForItemAtIndex(index as Integer)
- method popUpMenuPositioningItem(item as NSMenuItemMBS, location as NSPointMBS, view as NSViewMBS = nil) as boolean
- method removeAllItems
- method removeItem(m as NSMenuItemMBS)
- method removeItemAtIndex(index as Integer)
- method selectedItems as NSMenuItemMBS() New in 23.5
- method setSelectedItems(items() as NSMenuItemMBS) New in 23.5
- method update
- 14 shared methods
- shared method helpMenu as NSMenuMBS
- shared method mainMenu as NSMenuMBS
- shared method menuBarVisible as boolean
- shared method NSMenuDidAddItemNotification as string
- shared method NSMenuDidBeginTrackingNotification as string
- shared method NSMenuDidChangeItemNotification as string
- shared method NSMenuDidEndTrackingNotification as string
- shared method NSMenuDidRemoveItemNotification as string
- shared method NSMenuDidSendActionNotification as string
- shared method NSMenuWillSendActionNotification as string
- shared method paletteMenuWithColors(colors() as NSColorMBS, itemTitles() as String, templateImage as NSImageMBS = nil) as NSMenuMBS New in 23.5
- shared method popUpContextMenu(menu as NSMenuMBS, theEvent as NSEventMBS, view as NSViewMBS, font as NSFontMBS = nil)
- shared method setMenuBarVisible(value as boolean)
- shared method windowsMenu as NSMenuMBS
- 5 constants
Presentation Styles
Constant | Value | Description |
---|---|---|
PresentationStylePalette | 1 |
The menu marked as palette is to be displayed in place of the menu item presenting it, with its items aligned horizontally. |
PresentationStyleRegular | 0 |
The default presentation style. Typically means the menu will be presented as either a popup or pulldown menu, based on the context. |
Selection Modes
Constant | Value | Description |
---|---|---|
SelectionModeAutomatic | 0 |
The menu will determine the appropriate selection mode based on the context and its contents. |
SelectionModeSelectAny | 2 |
The user can select multiple items in the menu. A change in selection will not automatically deselect any previously selected item in the same selection group. |
SelectionModeSelectOne | 1 |
The user will be allowed to select at most one menu item in the same selection group at a time. A change in selection will deselect any previously selected item. |
This class has no sub classes.
Some methods using this class:
- ContinuityCameraMBS.PopupMenu as NSMenuMBS
- NSCellMBS.defaultMenu as NSMenuMBS
- NSSpellCheckerMBS.menuForResult(TextCheckingResult as NSTextCheckingResultMBS, checkedString as string, options as Dictionary = nil, atLocation as NSPointMBS, view as NSViewMBS) as NSMenuMBS
- NSStatusItemMBS.popUpStatusItemMenu(menu as NSMenuMBS)
Some properties using for this class:
- NSApplicationMBS.helpMenu as NSMenuMBS
- NSApplicationMBS.mainMenu as NSMenuMBS
- NSApplicationMBS.windowsMenu as NSMenuMBS
- NSMenuItemMBS.submenu as NSMenuMBS
- NSMenuMBS.supermenu as NSMenuMBS
- NSPopUpButtonCellMBS.menu as NSMenuMBS
- NSPopUpButtonMBS.menu as NSMenuMBS
- NSStatusItemMBS.Menu as NSMenuMBS
- NSSearchFieldMBS.searchMenuTemplate as NSMenuMBS
- NSSegmentedControlMBS.menuForSegment(segment as Integer) as NSMenuMBS
Some events using this class:
- CustomNSTextFieldMBS.menuForEvent(e as NSEventMBS, defaultMenu as NSMenuMBS) as NSMenuMBS
- CustomNSTextViewMBS.menuForEvent(e as NSEventMBS, defaultMenu as NSMenuMBS) as NSMenuMBS
- CustomNSTokenFieldMBS.menuForEvent(e as NSEventMBS, defaultMenu as NSMenuMBS) as NSMenuMBS
- DesktopNSTokenFieldControlMBS.menuForRepresentedObject(representedObject as Variant) as NSMenuMBS
- DesktopWKWebViewControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- DesktopWKWebViewControlMBS.willShowContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- NSApplicationDelegateMBS.applicationDockMenu as NSMenuMBS
- NSTokenFieldMBS.menuForRepresentedObject(representedObject as Variant) as NSMenuMBS
- WKWebViewControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- WKWebViewControlMBS.willShowContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
Some examples using this class:
- /MacCocoa/Dock Menu/Dock menu with ApplicationDelegate
- /MacCocoa/NSStatusItem/Statusitem Counter
- /MacCocoa/NSStatusItem/StatusItem with CarbonEvents
- /MacCocoa/NSStatusItem/Statusitem with PopOver
- /MacCocoa/NSStatusItem/Statusitem with slider in menubar
- /MacCocoa/NSStatusItem/Statusitem with textfield in menubar
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Simple Demo with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV TableView
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListboxTV with ContainerControl Cells
- /MacControls/TokenField/TokenField with data class
Blog Entries
- MonkeyBread Software Releases the MBS Xojo Plugins in version 23.5
- More Menubar options in macOS Sonoma
- MBS Xojo Plugins, version 23.5pr2
- MBS Xojo / Real Studio Plugins, version 15.5pr1
- MBS Xojo / Real Studio Plugins, version 15.2pr1
- Apply fonts to font PopupMenu
- MBS Xojo / Real Studio Plugins, version 14.3pr1
- MBS Xojo / Real Studio Plugins, version 14.0pr2
- MBS Real Studio Plugins, version 13.1pr13
- MBS Real Studio Plugins, version 12.3pr11
Xojo Developer Magazine
Release notes
- Version 23.5
- Added new methods and properties to NSMenuMBS and NSMenuItemMBS for macOS Sonoma for palette menus and section headers.
The items on this page are in the following plugins: MBS MacBase Plugin.
NSMenuItemMBS - NSMetadataItemMBS
