Platforms to show: All Mac Windows Linux Cross-Platform
NSMenuItemMBS 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.
- 2 events
- event Action
- event validateMenuItem(menuItem as NSMenuItemMBS) as boolean
- 28 properties
- property ActionSelector as String
- property Alternate as boolean
- property attributedTitle as NSAttributedStringMBS
- property Enabled as boolean
- property Handle as Integer
- property hasSubmenu as boolean
- property Identifier as String
- property image as NSImageMBS
- property indentationLevel as Integer
- property isHidden as boolean
- property isHiddenOrHasHiddenAncestor as boolean
- property isHighlighted as boolean
- property isSectionHeader as Boolean
- property isSeparatorItem as boolean
- property keyEquivalent as String
- property keyEquivalentModifierMask as Integer
- property menu as NSMenuMBS
- property mixedStateImage as NSImageMBS
- property offStateImage as NSImageMBS
- property onStateImage as NSImageMBS
- property parentItem as NSMenuItemMBS
- property state as Integer
- property submenu as NSMenuMBS
- property tag as Integer
- property Title as String
- property toolTip as String
- property userKeyEquivalent as String
- property view as NSViewMBS
- property usesUserKeyEquivalents as boolean
- 11 methods
- method clearAction
- method Constructor(DesktopMenuitem as DesktopMenuitem)
- method Constructor(Handle as Integer)
- method Constructor(MenuItem as MenuItem)
- method Constructor(Other as NSMenuItemMBS)
- method Constructor(title as string="", keyEquivalent as string="")
- method CreateMenuItem(title as string="", keyEquivalent as string="")
- method CreateSeparator
- method PerformAction(delay as double = 0) New in 25.0
- method setAction(target as NSResponderMBS, selectorName as string)
- method setTitleWithMnemonic(title as String)
- 5 shared methods
- shared method MenuItem(DesktopMenuItem as DesktopMenuItem) as NSMenuItemMBS
- shared method MenuItem(MenuItem as MenuItem) as NSMenuItemMBS
- shared method sectionHeaderWithTitle(Title as String) as NSMenuItemMBS
- shared method separatorItem as NSMenuItemMBS
- shared method writingToolsItems as NSMenuItemMBS() New in 25.0
- 3 constants
Constants
Constant | Value | Description |
---|---|---|
NSMixedState | -1 |
One of the constants for the state property.
The corresponding feature is in effect somewhere. |
NSOffState | 0 |
One of the constants for the state property.
The corresponding feature is in effect nowhere. |
NSOnState | 1 |
One of the constants for the state property.
The corresponding feature is in effect everywhere. |
This class has no sub classes.
Blog Entries
- News from the MBS Xojo Plugins Version 25.0
- Intercept Menus with MBS Xojo Plugins
- MBS Xojo Plugins, version 25.0pr7
- MonkeyBread Software Releases the MBS Xojo Plugins in version 23.5
- More Menubar options in macOS Sonoma
- News from the MBS Xojo Plugins Version 23.3
- MBS Xojo Plugins 18.3
- Custom menu checkmarks
- Apply fonts to font PopupMenu
- MonkeyBread Software Releases the MBS Real Studio plug-ins in version 13.1
Xojo Developer Magazine
- 5.6, page 49: Made in the Shade, Using Core Graphics in a REALbasic Project by Toby Rush
- 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
- 16.5, page 9: News
Release notes
- Version 25.0
- Added PerformAction method to NSMenuItemMBS class.
- Added writingToolsItems shared method to NSMenuItemMBS class.
- 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.
- Version 22.0
- Fixed Constructor and MenuItem function in NSMenuItemMBS class to work for DesktopMenuItem.
- Version 20.3
- Added clearAction method for NSMenuItemMBS class.
- Version 18.3
- Added Menuitem function to NSMenuItemMBS class.
- Reworked NSMenuItemMBS to make all properties visible in debugger.
Some methods using this class:
- NSMenuMBS.addItem(m as NSMenuItemMBS)
- NSMenuMBS.indexOfItem(item as NSMenuItemMBS) as Integer
- NSMenuMBS.insertItem(m as NSMenuItemMBS, index as Integer)
- NSMenuMBS.Item(index as Integer) as NSMenuItemMBS
- NSMenuMBS.items as NSMenuItemMBS()
- NSMenuMBS.itemWithSelector(selector as string) as NSMenuItemMBS
- NSMenuMBS.popUpMenuPositioningItem(item as NSMenuItemMBS, location as NSPointMBS, view as NSViewMBS = nil) as boolean
- NSMenuMBS.removeItem(m as NSMenuItemMBS)
- NSPopUpButtonCellMBS.itemAtIndex(Index as Integer) as NSMenuItemMBS
- NSPopUpButtonMBS.itemWithTitle(title as string) as NSMenuItemMBS
Some properties using for this class:
- NSMenuItemCellMBS.menuItem as NSMenuItemMBS
- NSMenuItemMBS.parentItem as NSMenuItemMBS
- NSMenuMBS.highlightedItem as NSMenuItemMBS
- NSPopUpButtonCellMBS.lastItem as NSMenuItemMBS
- NSPopUpButtonCellMBS.selectedItem as NSMenuItemMBS
- NSToolbarItemMBS.menuFormRepresentation as NSMenuItemMBS
- NSPopUpButtonMBS.selectedItem as NSMenuItemMBS
Some events using this class:
- NSMenuItemMBS.validateMenuItem(menuItem as NSMenuItemMBS) as boolean
- NSMenuMBS.willHighlightItem(item as NSMenuItemMBS)
- NSMenuPopupEventsMBS.popUpMenuAtPosition(menu as NSMenuMBS, item as NSMenuItemMBS, location as NSPointMBS, view as NSViewMBS) as Boolean
Some examples using this class:
- /MacBase/Menus/MacSonomaMenu
- /MacCocoa/NSStatusItem/Statusitem Counter
- /MacCocoa/NSStatusItem/StatusItem with CarbonEvents
- /MacCocoa/NSStatusItem/Statusitem with textfield in menubar
- /MacCocoa/Popupmenu Icons for Cocoa
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Flat Only/ListBoxTV Database with DataSource
- /MacControls/Listbox and TableView Demos/ListboxTV drop-in/Hierarchical & Flat/ListBoxTV OutlineView
- /MacControls/PopupMenu in Cocoa
- /MacControls/Popupmenu Retina Icons
- /MacControls/Toolbar/Toolbar buttons/Toolbar buttons
Some related classes:
- class Database
- class NSAppearanceMBS
- class NSAttributedStringMBS
- class NSMenuItemCellMBS
- class NSMenuMBS
- class NSMenuPopupEventsMBS
- class NSPointMBS
- class NSPopUpButtonCellMBS
- class NSResponderMBS
- class NSViewMBS
The items on this page are in the following plugins: MBS MacBase Plugin.
