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
- event willHighlightItem(item as NSMenuItemMBS)
- event WillOpen
- 18 properties
- property allowsContextMenuPlugIns as boolean
- property autoenablesItems as Boolean
- property automaticallyInsertsWritingToolsItems as boolean New in 25.0
- property debugItems as Variant New in 25.0
- property Font as NSFontMBS
- property Handle as Integer
- property highlightedItem as NSMenuItemMBS
- property Identifier as String
- property menuBarHeight as Double
- property minimumWidth as Double
- property numberOfItems as Integer
- property presentationStyle as Integer
- property selectionMode as Integer
- property showsStateColumn as boolean
- property size as NSSizeMBS
- property supermenu as NSMenuMBS
- property Title as String
- property userInterfaceLayoutDirection as Integer
- 22 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 items as NSMenuItemMBS() New in 25.0
- 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()
- method setSelectedItems(items() as NSMenuItemMBS)
- 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
- 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:
- DesktopAVPlayerViewControlMBS.actionPopUpButtonMenu as NSMenuMBS
- NSApplicationMBS.helpMenu as NSMenuMBS
- NSApplicationMBS.mainMenu as NSMenuMBS
- NSApplicationMBS.windowsMenu as NSMenuMBS
- NSMenuToolbarItemMBS.menu as NSMenuMBS
- NSPathControlMBS.Menu as NSMenuMBS
- NSPopUpButtonCellMBS.menu as NSMenuMBS
- NSSearchFieldCellMBS.searchMenuTemplate as NSMenuMBS
- NSStatusItemMBS.Menu as NSMenuMBS
- NSSearchFieldMBS.searchMenuTemplate as NSMenuMBS
Some events using this class:
- AVCaptureViewControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- DesktopAVPlayerViewControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- DesktopIKCameraDeviceViewControlMBS.willShowContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- DesktopQLPreviewViewControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- IKDeviceBrowserViewControlMBS.willShowContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- NSApplicationDelegateMBS.applicationDockMenu as NSMenuMBS
- NSButtonControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- NSDatePickerControlMBS.willShowContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- NSSecureTextFieldControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- NSSegmentedControlControlMBS.didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
Some examples using this class:
- /MacBase/Menus/NSMenuPopupEvents
- /MacCocoa/Dock Menu/Dock menu with ApplicationDelegate
- /MacCocoa/NSStatusItem/StatusItem with CarbonEvents
- /MacCocoa/NSStatusItem/StatusItem with NSView
- /MacCocoa/NSStatusItem/Statusitem with PopOver
- /MacCocoa/NSStatusItem/Statusitem with PopOver using Container
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Database with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV TableView
- /MacControls/PopupMenu in Cocoa
- /MacFrameworks/Cocoa Controls/SearchField with menu
Blog Entries
- Intercept Menus with MBS Xojo Plugins
- Using writing tools in Xojo for Apple Intelligence
- MBS Xojo Plugins, version 24.6pr5
- MBS Xojo Plugins, version 24.2pr4
- MBS Xojo Plugins, version 24.1pr4
- News from the MBS Xojo Plugins Version 23.5
- MonkeyBread Software Releases the MBS Xojo Plugins in version 23.5
- More Menubar options in macOS Sonoma
- MBS Xojo Plugins, version 23.5pr2
- Apply fonts to font PopupMenu
Xojo Developer Magazine
- 5.6, page 33: Third Party Plugins: Statusitems, Getting an icon in the top right of the Mac OS X menubar by Christian Schmitz
- 22.1, page 9: News
Release notes
- Version 25.0
- Version 24.2
- Improved effectiveAppearance and appearance methods in NSAppearanceMBS class to allow passing NSMenuMBS, NSMenuItemMBS, MenuItem or DesktopMenuItem objects.
- Version 24.1
- Added Identifier property to NSCellMBS, NSMenuItemMBS, NSMenuMBS and NSViewControllerMBS classes.
- 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 - NSMenuPopupEventsMBS