Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSMenuItemMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Call this method once to have a menuitem which has no action.
NSMenuItemMBS.Constructor(DesktopMenuitem as DesktopMenuitem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 22.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
May raise UnsupportedOperationException or NilObjectException if used incorrectly.
See also:
NSMenuItemMBS.Constructor(Handle as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Useful if you get a NSMenuItem reference from a declare.
The object is retained.
See also:
NSMenuItemMBS.Constructor(MenuItem as MenuItem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 18.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
May raise UnsupportedOperationException or NilObjectException if used incorrectly.
See also:
NSMenuItemMBS.Constructor(Other as NSMenuItemMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 22.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
See also:
NSMenuItemMBS.Constructor(title as string="", keyEquivalent as string="")
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Handle is not 0 after this call if it was successfull.
name and charcode are optional and can be "".
Charcode is the initial keyEquivalent for this menu item.
You can set the KeyEquivalentModifierMask to get different modifier keys.
See also:
NSMenuItemMBS.CreateMenuItem(title as string="", keyEquivalent as string="")
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Handle is not 0 after this call if it was successfull.
name and charcode are optional and can be "".
Charcode is the initial keyEquivalent for this menu item.
You can set the KeyEquivalentModifierMask to get different modifier keys.
Deprecated, please use the Constructor instead.
Some examples using this method:
- /Mac64bit/WebKit2/DesktopWebView
- /Mac64bit/WebKit2/WebView
- /MacCocoa/Dock Menu/Dock menu with ApplicationDelegate
- /MacCocoa/NSSearchField control with menu
- /MacCocoa/NSStatusItem/Statusitem Counter
- /MacCocoa/NSStatusItem/Statusitem with slider in menubar
- /MacControls/Search Field/SearchField with menu
- /MacControls/TokenField/TokenField with data class
- /MacControls/Toolbar/Toolbar buttons/Toolbar buttons
- /MacFrameworks/Cocoa Controls/SearchField with menu
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Some examples using this method:
- /Mac64bit/WebKit2/DesktopWebView
- /Mac64bit/WebKit2/WebView
- /MacCocoa/Dock Menu/Dock menu with ApplicationDelegate
- /MacCocoa/NSSearchField control with menu
- /MacCocoa/NSStatusItem/StatusItem
- /MacCocoa/NSStatusItem/StatusItem easy
- /MacCocoa/NSStatusItem/StatusItem with CarbonEvents
- /MacCocoa/NSStatusItem/StatusItem with Image in menu
- /MacCocoa/NSStatusItem/Statusitem with textfield in menubar
- /MacControls/Search Field/CustomSearchField with menu
NSMenuItemMBS.setAction(target as NSResponderMBS, selectorName as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 23.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Please make sure the selector is correct as otherwise you get an exception later.
And make sure the target object stays alive.
NSMenuItemMBS.setTitleWithMnemonic(title as String)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Menus | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Use an ampersand character to mark the character (the one following the ampersand) to be designated.
Deprecated by Apple.
The items on this page are in the following plugins: MBS MacBase Plugin.