Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Next items

NSMenuItemMBS.ActionSelector as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 13.1 Yes No No Yes, macOS only No
Function: Returns the name of the objective-c method called for this menu event.
Notes: You can use this to find menu items by their selector. Which is often more save than by index or title.

Feedback, Comments & Corrections

NSMenuItemMBS.Alternate as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Whether this menu item is an alternate to the previous menu item.
Notes:
Available in Mac OS X v10.3 and later.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.attributedTitle as NSAttributedStringMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Specifies a custom string for a menu item.
Notes:
You can use this method to add styled text and embedded images to menu item strings. If you do not set a text color for the attributed string, it is black when not selected, white when selected, and gray when disabled. Colored text remains unchanged when selected.

When you call this method to set the menu title to an attributed string, the setTitle: method is also called to set the menu title with a plain string. If you clear the attributed title, the plain title remains unchanged.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.Constructor(Handle as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 15.2 Yes No No Yes, macOS only No
Function: Constructor for creating an instanced based on an existing handle.
Example:
dim m as MenuItem = EditCopy
dim h as Integer = m.Handle(MenuItem.HandleType.CocoaNSMenuItem)
dim i as new NSMenuItemMBS(h)

i.Title = "Hello"
Notes:
Useful if you get a NSMenuItem reference from a declare.
The object is retained.

See also:

Feedback, Comments & Corrections

NSMenuItemMBS.Constructor(title as string="", keyEquivalent as string="")
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 15.2 Yes No No Yes, macOS only No
Function: Creates a new menu items.
Notes:
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:

Feedback, Comments & Corrections

NSMenuItemMBS.CreateMenuItem(title as string="", keyEquivalent as string="")
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Creates a new menu items.
Notes:
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.

Feedback, Comments & Corrections

NSMenuItemMBS.CreateSeparator
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Creates a Separator menu item.

Feedback, Comments & Corrections

NSMenuItemMBS.Enabled as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Whether this menuitem is enabled.
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.hasSubmenu as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Returns true if the menuitem has a submenu, false if it doesn't.

Feedback, Comments & Corrections

NSMenuItemMBS.image as NSImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The image displayed by the menuitem, or nil if it displays no image.
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.indentationLevel as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The menu item indentation level for the menu item.
Notes:
The value will be from 0 to 15. The default indentation level is 0.
Available in Mac OS X v10.3 and later.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.isHidden as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.7 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the menuitem is hidden.
Notes:
Mac OS X 10.5 only.
Returns true if the receiver is hidden, otherwise false.
This value can be set to hide or show a menuitem.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.isHiddenOrHasHiddenAncestor as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.7 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the menuitem or any of its superitems is hidden.
Notes:
Mac OS X 10.5 only.
Returns true if the receiver or any of its superitems is hidden, otherwise false.

Feedback, Comments & Corrections

NSMenuItemMBS.isHighlighted as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.7 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the receiver should be drawn highlighted.
Notes:
Returns true if the receiver should be drawn highlighted, otherwise false.
Mac OS X 10.5 only.

Feedback, Comments & Corrections

NSMenuItemMBS.isSeparatorItem as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: Returns whether the receiver is a separator item (that is, a menu item used to visually segregate related menu items).

Feedback, Comments & Corrections

NSMenuItemMBS.keyEquivalent as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The receiver's unmodified keyboard equivalent, or the empty string if one hasn't been defined.
Example:
dim m as new NSMenuItemMBS
m.CreateMenuItem "Hello"
m.keyEquivalent = "a" // A
m.keyEquivalent = "A" // shift-A
Notes:
Use keyEquivalentModifierMask to determine the modifier mask for the key equivalent. In the current implementation "A" can be interpreted as Shift-A by the system even without the shift in the mask.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.keyEquivalentModifierMask as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: the menu item's keyboard equivalent modifier mask.
Example:
const NSShiftKeyMask=131072
const NSControlKeyMask=262144
const NSAlternateKeyMask=524288
const NSCommandKeyMask=1048576

dim d as new NSMenuItemMBS
d.CreateMenuItem "Last menu entry",""
d.Enabled=true
d.KeyEquivalent="A"
d.KeyEquivalentModifierMask=NSShiftKeyMask+NSCommandKeyMask+NSAlternateKeyMask // command-option-shift
Notes:
Constants for the mask:

NSAlphaShiftKeyMask = 65536
Set if Caps Lock key is pressed.
Available in Mac OS X v10.0 and later.

NSShiftKeyMask = 131072
Set if Shift key is pressed.
Available in Mac OS X v10.0 and later.

NSControlKeyMask = 262144
Set if Control key is pressed.
Available in Mac OS X v10.0 and later.

NSAlternateKeyMask = 524288
Set if Option or Alternate key is pressed.
Available in Mac OS X v10.0 and later.

NSCommandKeyMask = 1048576
Set if Command key is pressed.
Available in Mac OS X v10.0 and later.

NSNumericPadKeyMask = 2097152
Set if any key in the numeric keypad is pressed. The numeric keypad is generally on the right side of the keyboard. This is also set if any of the arrow keys are pressed (NSUpArrowFunctionKey, NSDownArrowFunctionKey, NSLeftArrowFunctionKey, and NSRightArrowFunctionKey).
Available in Mac OS X v10.0 and later.

NSHelpKeyMask = 4194304
Set if the Help key is pressed.
Available in Mac OS X v10.0 and later.

NSFunctionKeyMask = 8388608
Set if any function key is pressed. The function keys include the F keys at the top of most keyboards (F1, F2, and so on) and the navigation keys in the center of most keyboards (Help, Forward Delete, Home, End, Page Up, Page Down, and the arrow keys).
Available in Mac OS X v10.0 and later.

NSDeviceIndependentModifierFlagsMask = 16777216
Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
Available in Mac OS X v10.4.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.menu as NSMenuMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The menu where this menu item is inside.
Notes: nil if no menu belongs to this menuitem.

Feedback, Comments & Corrections

NSMenuItemMBS.mixedStateImage as NSImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The image used to depict a "mixed state."
Notes:
A mixed state is useful for indicating "off" and "on" attribute values in a group of selected objects, such as a selection of text containing bold and plain (nonbolded) words.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.offStateImage as NSImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The image used to depict the receiver's "off" state, or nil if the image has not been set.
Notes:
By default, there is no off state image.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.onStateImage as NSImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The image of the receiver that indicates an "on" state.
Notes:
The Image object to use for the "on" state of the menu item. If itemImage is nil, any current on-state image is removed.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.parentItem as NSMenuItemMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 9.6 Yes No No Yes, macOS only No
Function: Returns the menu item whose submenu contains the receiver.
Notes:
Returns the parent menu item, or nil if the receiver does not have a parent item.
Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSMenuItemMBS.setTitleWithMnemonic(title as String)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 9.6 Yes No No Yes, macOS only No
Function: Sets the title of a menu item with a character denoting an access key.
Notes:
Use an ampersand character to mark the character (the one following the ampersand) to be designated.
Deprecated by Apple.

Feedback, Comments & Corrections

NSMenuItemMBS.state as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The state of the menuitem.
Notes:
An integer constant representing a state; it should be one of NSOffState, NSOnState, or NSMixedState.
Same as Checked property on Real Studio's menu items.

Constants:
NSMixedState = -1The corresponding feature is in effect somewhere.
NSOffState = 0The corresponding feature is in effect nowhere.
NSOnState = 1The corresponding feature is in effect everywhere.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.submenu as NSMenuMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The submenu attached to this menuitem.
Notes:
nil if there is no submenu.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.tag as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The menu item tag value.
Notes:
You can use this value as you like.

If you need to store more custom data than just an integer, you should subclass the NSMenuItemMBS class and add properties as needed.
(Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.Title as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The title of the menu item.
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.toolTip as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The help tag for a menu item.
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

NSMenuItemMBS.userKeyEquivalent as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Menus MBS MacBase Plugin 7.2 Yes No No Yes, macOS only No
Function: The user-assigned key equivalent for the menu item.

Feedback, Comments & Corrections

Next items

The items on this page are in the following plugins: MBS MacBase Plugin.




Links
MBS Xojo Plugins