Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

menuItem [-allowOptionBoxes boolean] [-altModifier boolean] [-annotation string] [-boldFont boolean] [-checkBox boolean] [-collection string] [-command script] [-commandModifier boolean] [-ctrlModifier boolean] [-data int] [-divider boolean] [-docTag string] [-dragDoubleClickCommand script] [-dragMenuCommand script] [-echoCommand boolean] [-enable boolean] [-enableCommandRepeat boolean] [-familyImage string] [-image string] [-imageOverlayLabel string] [-insertAfter string] [-isCheckBox] [-isOptionBox] [-isRadioButton] [-italicized boolean] [-keyEquivalent string] [-label string] [-optionBox boolean] [-optionBoxIcon string] [-optionModifier boolean] [-parent string] [-postMenuCommand script] [-postMenuCommandOnce boolean] [-radialPosition string] [-radioButton boolean] [-shiftModifier boolean] [-sourceType string] [-subMenu boolean] [-tearOff boolean] [string]

menuItem is undoable, queryable, and editable.

This command creates/edits/queries menu items.

Return value

stringFull path name to the menu item.

In query mode, return type is based on queried flag.

Flags

allowOptionBoxes, altModifier, annotation, boldFont, checkBox, collection, command, commandModifier, ctrlModifier, data, divider, docTag, dragDoubleClickCommand, dragMenuCommand, echoCommand, enable, enableCommandRepeat, familyImage, image, imageOverlayLabel, insertAfter, isCheckBox, isOptionBox, isRadioButton, italicized, keyEquivalent, label, optionBox, optionBoxIcon, optionModifier, parent, postMenuCommand, postMenuCommandOnce, radialPosition, radioButton, shiftModifier, sourceType, subMenu, tearOff
Long name (short name) Argument types Properties
-label(-l) string createqueryedit
The text that appears in the item.
-divider(-d) boolean createquery
Creates a divider menu item.
-checkBox(-cb) boolean createqueryedit
Creates a check box menu item. Argument specifies the check box value.
-isCheckBox(-icb) query
Returns true if the item is a check box item.
-radioButton(-rb) boolean createqueryedit
Creates a radio button menu item. Argument specifies the radio button value.
-isRadioButton(-irb) query
Returns true if the item is a radio button item.
-optionBox(-ob) boolean createquery
Indicates that the menu item will be an option box item. This item will appear to the right of the preceeding menu item.
-isOptionBox(-iob) query
Returns true if the item is an option box item.
-optionBoxIcon(-obi) string createqueryedit
The filename of an icon to be used instead of the usual option box icon. The icon is searched for in the folder specified by the XBMLANGPATH environment variable. The icon can be any size, but will be resized to the standard 16x16 pixels when drawn.
-enable(-en) boolean createqueryedit
Enable state for the menu item. A disabled menu item is dimmed and unresponsive. An enabled menu item is selectable and has normal appearance.
-parent(-p) string create
Specify the menu that the item will appear in.
-insertAfter(-ia) string create
Specify After which item the new one will be placed. If this flag is not specified, item is added at the end of the menu. Use the empty string "" to insert before the first item of the menu.

WARNING: This flag is known to cause problems with tear off menus. It is recommended that you do not use it with menus that are tear off enabled. In other words, the parent menu should not have its to/tearOff flag set.

-collection(-cl) string createquery
To explicitly add a radio menu item to a radioMenuItemCollection.
-image(-i) string createqueryedit
The filename of the icon associated with the menu item. If the menu containing the menu item is being edited with a menuEditor widget, then the menuEditor will use this icon to represent the menu item. This icon will be displayed on the shelf when the menu item is placed there.
-imageOverlayLabel(-iol) string createqueryedit
Specify a short (5 character) text string to be overlayed on top of the icon associated with the menu item. This is primarily a mechanism for differentiating menu items that are using a Family icon due to the fact that an icon image had not been explicitly defined. The image overlay label will not be used if an icon image is defined for the menu item.
-familyImage(-fi) string query
Get the filename of the family icon associated with the menu. The family icon will be used for the shelf unless an icon is specified with the image flag.
-allowOptionBoxes(-aob) boolean createquery
Deprecated. All menus and menu items always allow option boxes. In the case of submenu items this flag specifies whether the submenu will be able to support option box menu items. Always returns true.
-subMenu(-sm) boolean createquery
Indicates that the item will have a submenu. Subsequent menuItems will be added to the submenu until setParent -menu is called. Note that a submenu item creates a menu object and consequently the menu command may be used on the submenu item.
-tearOff(-to) boolean createquery
For the case where the menu item is a sub menu this flag will make the sub menu tear-off-able. Note that this flag has no effect on the other menu item types.
-annotation(-ann) string createqueryedit
Annotate the menu item with an extra string value.
-docTag(-dtg) string createqueryedit
Attaches a tag to the menu item.
-data(-da) int createqueryedit
Attaches a piece of user-defined data to the menu item.
-radialPosition(-rp) string createqueryedit
The radial position of the menu item if it is in a Marking Menu. Radial positions are given in the form of a cardinal direction, and may be "N", "NW", "W", "SW", "S", "SE", "E" or "NE".
-command(-c) script createqueryedit
Attaches a command/script that will be executed when the item is selected. Note this command is not executed when the menu item is in an optionMenu control.
-dragMenuCommand(-dmc) script createqueryedit
If the menu item is put on the shelf then this command will be invoked when the corresponding shelf object is clicked.
-dragDoubleClickCommand(-ddc) script createqueryedit
If the menu item is put on the shelf then this command will be invoked when the corresponding shelf object is double clicked.
-postMenuCommand(-pmc) script createqueryedit
Specify a script to be executed when the submenu is about to be shown.
-postMenuCommandOnce(-pmo) boolean createqueryedit
Indicate the pmc/postMenuCommand should only be invoked once. Default value is false, ie. the pmc/postMenuCommand is invoked everytime the sub menu is shown.
-sourceType(-stp) string createqueryedit
Set the language type for a command script. Can only be used in conjunction with a command flag. Without this flag, commands are assumed to be the same language of the executing script. In query mode, will return the language of the specified command. Valid values are "mel" and "python".
-keyEquivalent(-ke) string createqueryedit
Specify the accelerator character. This character is combined with the modifier keys specified with the alt/altModifier, opt/optionModifier, ctl/ctlModifier, cmd/commandModifier and sh/shiftModifier to form the complete accelerator sequence that you can type to execute the menu item. Note that only regular menu items, radio menu items and check box menu items can have an accelerator.
-altModifier(-alt) boolean createqueryedit
Specify this flag if the Alt modifier is part of the accelerator sequence.
-optionModifier(-opt) boolean createqueryedit
Specify this flag if the Alt (or option) modifier is part of the accelerator sequence.
-ctrlModifier(-ctl) boolean createqueryedit
Specify this flag if the Cntl modifier is part of the accelerator sequence.
-commandModifier(-cmd) boolean createqueryedit
Specify this flag if the command modifier is part of the accelerator sequence. This is only available on systems which have a separate command key.
-shiftModifier(-sh) boolean createqueryedit
Specify this flag if the Shift modifier is part of the accelerator sequence.
-enableCommandRepeat(-ecr) boolean createqueryedit
This flag only affects menu items to which a command can be attached. Specify true and the command may be repeated by executing the command repeatLast. This flag is true by default for all items except for option box items.
-echoCommand(-ec) boolean createqueryedit
Specify whether the action attached with the c/command flag should echo to the command output areas when invoked. This flag is false by default and must be specified with the c/command flag.
-italicized(-itl) boolean createquery
Specify if text should be italicized. Only supported in menus which use the marking menu implementation. Default is false.
-boldFont(-bld) boolean createquery
Specify if text should be bold. Only supported in menus which use the marking menu implementation. Default is false for Windows, and true for all other platforms.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

window -menuBar true -width 200;
    menu -label "Stuff";
        menuItem -subMenu true -label "Colors";
            menuItem -label "Blue";
            menuItem -label "Green";
            menuItem -label "Yellow";
            setParent -menu ..;
        menuItem -divider true;
        radioMenuItemCollection;
        menuItem -label "Yes"   -radioButton off;
        menuItem -label "Maybe" -radioButton off;
        menuItem -label "No"    -radioButton on;
        menuItem -divider true;
        menuItem -label "Top"    -checkBox on;
        menuItem -label "Middle" -checkBox off;
        menuItem -label "Bottom" -checkBox on;
        menuItem -divider true;
        menuItem -label "Option";
        menuItem -optionBox true;
    columnLayout;
        button; button; button;
showWindow;