Menu.AddItem

Description

Adds a menu item at to end of the menu. Note: To add a MenuItem that invokes a command or callback it is better to use Menu.AddCommandItem or Menu.AddCallbackItem.

Note:It's preferable to use Menu.AddSubMenu in python for adding sub-menu objects instead of invoking AddItem with siMenuItemSubmenu.

Tip: See the C++ API and Python examples for creating a Simple Menu plug-in to see this method in action.

Note: This method could return an invalid object in python, use Menu.AddItem2 instead.

C# Syntax

MenuItem Menu.AddItem( String in_pLabel, siMenuItemStyle in_style );

Scripting Syntax

oReturn = Menu.AddItem( Label, Style );

Return Value

If the style is siMenuItemSubmenu the newly created Menu is returned. Otherwise the newly created MenuItem is returned.

Parameters

Parameter Type Description
Label String The menu item label.
Style siMenuItemStyle The menu item style, for example siMenuItemSubmenu.

See Also

MenuItem Menu.AddSubMenu Menu.AddSeparatorItem Menu.AddCommandItem Menu.AddCallbackItem Definition Callbacks for Menus Simple Menu plug-in example