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

Synopsis

menu [-allowOptionBoxes boolean] [-deleteAllItems] [-docTag string] [-enable boolean] [-familyImage string] [-helpMenu boolean] [-itemArray] [-label string] [-mnemonic string] [-numberOfItems] [-parent string] [-postMenuCommand script] [-postMenuCommandOnce boolean] [-tearOff boolean] [string]

menu is undoable, queryable, and editable.

This command creates a new menu and adds it to the default window's menubar if no parent is specified. The menu can be enabled/disabled. Note that this command may also be used on menu objects created using the command menuItem -sm/subMenu true.

Return value

string Full path name to the menu.

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

Flags

allowOptionBoxes, deleteAllItems, docTag, enable, familyImage, helpMenu, itemArray, label, mnemonic, numberOfItems, parent, postMenuCommand, postMenuCommandOnce, tearOff
Long name (short name) Argument types Properties
-enable(-en) boolean createqueryedit
Enables/disables the menu.
-helpMenu(-hm) boolean createqueryedit
Indicates that this menu is the help menu and will be the right most menu in the menu bar. On Unix systems the help menu is also right justified in the menu bar.
-label(-l) string createqueryedit
The text that is displayed for the menu. If no label is supplied then the menuName will be used.
-mnemonic(-mn) string createqueryedit
Set the Alt key to post that menu. The character specified must match the case of its corresponding character in the menu item text, but selection from the keyboard is case insensitive.
-parent(-p) string create
Specify the window that the menu will appear in.
-tearOff(-to) boolean create
Makes the menu tear-off-able.
-allowOptionBoxes(-aob) boolean createquery
Deprecated. All menus now always allow option boxes. Indicate whether the menu will be able to support option box menu items.
-numberOfItems(-ni) query
Return number of items in the menu.
-itemArray(-ia) query
Return string array of the menu item names.
-postMenuCommand(-pmc) script createedit
Specify a script to be executed when the menu 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 every time the menu is shown.
-deleteAllItems(-dai) createedit
Delete all the items in this menu.
-familyImage(-fi) string createqueryedit
The filename of the icon associated with the menu. This icon will be used if a menu item does not have an icon image defined.
-docTag(-dtg) string createqueryedit
Attaches a tag to the menu.

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 "File" -tearOff true;
    menuItem -label "New";
    menuItem -label "Open";
    menuItem -label "Save";
    menuItem -divider true;
    menuItem -label "Quit";
menu -label "Help" -helpMenu true;
    menuItem -label "About Application...";
columnLayout;
    button; button; button;
showWindow;