use a menuBarLayout to add menu Functionality to your window. To add a menu to a window add the menuBarLayout directly after the window command.
To add a menubar to an element such as a tabLayout or a columnLayout add the menuBarLayout command right after you call the incasing layout command.
-menubarlayout
//create a menubar at the top of the window give it a file/exit option and a help menu
//create two tabs both containing menu items.
showWindow myMenuBar;
if (`window -exists myMenuBar`)
{
deleteUI myMenuBar;
windowPref -remove myMenuBar;
}
window -widthHeight 250 400 myMenuBar;
menuBarLayout;
menu -label "File";
menuItem -label "Exit" -command "deleteUI myMenuBar";
menu -label "Help" -helpMenu true;
string $docs = "Commands/index.html"; //this string tells where the help file is located
menuItem -label "About..." -command "showHelp -docs $docs";
setParent..;
string $tabs = `tabLayout`;
string $tab1 = `menuBarLayout`;
menu -label "Polys";
menuItem -label "Sphere" -command "polySphere -radius 1";
menuItem -label "Cube" -command "polyCube -width 1 -height 1 -depth 1";
menuItem -label "Cylinder" -command "polyCylinder -r 1 -h 1";
menu -label "Nurbs";
menuItem -label "Sphere" -command "sphere -r 1 -ax 0 90 0";
menuItem -label "Cube" -command "nurbsCube -w 1 -lr 1 -hr 1 ";
menuItem -label "Plane" -command "plane -w 1 -l 1 -r 90 0 0";
tabLayout -edit -tabLabel $tab1 "Commonly Used Geometry" $tabs;
showWindow myMenuBar;
|
<Top>