Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSMenuMBS class.
NSMenuMBS.helpMenu as NSMenuMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSMenuMBS.mainMenu as NSMenuMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
NSMenuMBS.menuBarVisible as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Available in Mac OS X v10.2 and later.
Returns true if the menu bar is visible, otherwise false.
NSMenuMBS.NSMenuDidAddItemNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
Posted after a menu item is added to the menu. The notification object is the instance of NSMenuMBS that just added the new menu item.
This is very useful to customize the menu in Xojo. The runtime rebuilds menu bar often, so you can catch it and edit menu.
The userInfo dictionary contains the following information:
NSMenuItemIndex: An integer index of the menu item that was added.
Some examples using this method:
NSMenuMBS.NSMenuDidBeginTrackingNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Posted when menu tracking begins. The notification object is the main menu bar (NSApplicationMBS mainMenu) or the root menu of a popup button. This notification does not contain a userInfo dictionary.
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
NSMenuMBS.NSMenuDidChangeItemNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
Posted after a menu item in the menu changes appearance. Changes include enabling/disabling, changes in state, and changes to title. The notification object is the instance of NSMenuMBS with the menu item that changed. The userInfo dictionary contains the following information:
Key | Value |
NSMenuItemIndex | An integer index of the menu item that changed. |
NSMenuMBS.NSMenuDidEndTrackingNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
Posted when menu tracking ends, even if no action is sent. The notification object is the main menu bar (NSApplicationMBS mainMenu) or the root menu of a popup button. This notification does not contain a userInfo
NSMenuMBS.NSMenuDidRemoveItemNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
Posted after a menu item is removed from the menu. The notification object is the instance of NSMenu that just removed the menu item. The userInfo dictionary contains the following information:
NSMenuItemIndex: An integer index of the menu item that was removed. Note that this index may no longer be valid and in any event no longer points to the menu item that was removed.
NSMenuMBS.NSMenuDidSendActionNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
Posted just after the application dispatches a menu item's action method to the menu item's target. The notification object is the instance of NSMenuMBS containing the chosen menu item. The userInfo dictionary contains the following information:
Key | Value |
MenuItem | The menu item that was chosen. |
NSMenuMBS.NSMenuWillSendActionNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use this constant with NSNotificationObserverMBS class to get an event when such a notification is sent.
Posted just before the application dispatches a menu item's action method to the menu item's target. The notification object is the instance of NSMenuMBS containing the chosen menu item. The userInfo dictionary contains the following information:
Key | Value |
MenuItem | The menu item that was chosen. |
NSMenuMBS.paletteMenuWithColors(colors() as NSColorMBS, itemTitles() as String, templateImage as NSImageMBS = nil) as NSMenuMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 23.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Optionally allows observing changes to the selection state in the compact menu. The block is invoked after the selection has been updated. Currently selected items can be retrieved from the `selectedItems` property.
Returns a palette menu.
Requires macOS Sonoma or newer.
Some examples using this method:
NSMenuMBS.popUpContextMenu(menu as NSMenuMBS, theEvent as NSEventMBS, view as NSViewMBS, font as NSFontMBS = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
menu: The menu object to use for the contextual menu.
event: An NSEvent object representing the event.
view: The view object over which to display the contextual menu.
font: An NSFont object representing the font for the contextual menu. If you pass in nil for the font, the method uses the default font for menu.
Specifying a font using the font parameter is discouraged. Instead set the menu’s font using the setFont: method and pass nil for the font parameter.
Some examples using this method:
NSMenuMBS.setMenuBarVisible(value as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
value: true if menu bar is to be visible, otherwise false.
Available in Mac OS X v10.2 and later.
NSMenuMBS.windowsMenu as NSMenuMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa Menus | MBS MacBase Plugin | 14.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The items on this page are in the following plugins: MBS MacBase Plugin.