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
- 10 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 setAction(target as NSResponderMBS, selectorName as string)
- method setTitleWithMnemonic(title as String)
- 4 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
- 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.
Some methods using this class:
- NSMenuMBS.indexOfItem(item as NSMenuItemMBS) as Integer
- NSMenuMBS.insertItem(m as NSMenuItemMBS, index as Integer)
- NSMenuMBS.itemWithSelector(selector as string) as NSMenuItemMBS
- NSMenuMBS.setSelectedItems(items() as NSMenuItemMBS)
- NSPopUpButtonCellMBS.indexOfItem(item as NSMenuItemMBS) as Integer
- NSPopUpButtonCellMBS.itemWithTitle(title as String) as NSMenuItemMBS
- NSPopUpButtonCellMBS.selectItem(item as NSMenuItemMBS)
- NSPopUpButtonMBS.itemAtIndex(index as Integer) as NSMenuItemMBS
- NSPopUpButtonMBS.selectItem(item as NSMenuItemMBS)
- SUUpdaterMBS.validateMenuItem(menuItem as NSMenuItemMBS) as Boolean
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)
Some examples using this class:
- /MacCocoa/NSStatusItem/StatusItem
- /MacCocoa/NSStatusItem/Statusitem Counter
- /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 with ContainerControl Cells
- /MacControls/PopupMenu in Cocoa
- /MacControls/TokenField/NSTokenFieldControl
- /MacFrameworks/Cocoa Controls/SearchField with menu
- /MacFrameworks/MapKit/MapKit Test
Blog Entries
- MBS Xojo Plugins, version 24.2pr4
- MBS Xojo Plugins, version 24.1pr4
- MonkeyBread Software Releases the MBS Xojo Plugins in version 23.5
- More Menubar options in macOS Sonoma
- MBS Xojo Plugins, version 23.5pr2
- 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 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.
The items on this page are in the following plugins: MBS MacBase Plugin.