Basic command:
1: string $layoutName= <insert name of layout here>;
2: layout -edit -width 200 $layoutName;
3: layout -query -numberOfChildren $layoutName;
4: layout -exists $layoutName;
ColumnLayout
1: window;
2: columnLayout -columnAttach "both" 12 -rowSpacing 8 -columnWidth 150 -adjustableColumn true;
3: button;
4: button;
5: showWindow;
RowLayout
1: window;
2: rowLayout -numberOfColumns 3 -columnWidth3 100 60 80 -columnAttach 1 "both" 0;
3: button;
4: button;
5: button;
6: showWindow;
In the row layout, the number of column must be explicitly defined.
GridLayout
1: window;
2: gridLayout -numberOfRowsColumns 2 2 -cellWidthHeight 60 50 mygrid;
3: button;
4: button;
5: button;
6: showWindow;
use -position can reposition the child elements, but I have not succeed. Every time, an error " Object is not the child" prompt out, I do not know why.
FormLayout
1: window;
2: string $form=`formLayout -numberOfDivisions 100`;
3: string $but1=`button`;
4: string $but2=`button`;
5: string $but3=`button`;
6: formLayout -edit
7: // Button 1
8: -attachForm $but1 "top" 0
9: -attachForm $but1 "left" 0
10: -attachForm $but1 "bottom" 0
11: -attachPosition $but1 "right" 0 50
12: // Button 2
13: -attachForm $but2 "right" 0
14: // Button 3
15: -attachPosition $but3 "top" 0 5
16: -attachControl $but3 "left" 5 $but1
17: $form;
18: showWindow;
The position of every element in form layout must be explicitly specified. Usually, the general procedure to add all the child elements to the form layout and then use its editing feature to finally position them.
FrameLayout
The layout that can expand and collapse.
1: window;
2: frameLayout -label "Settings" -borderStyle "etchedIn"
3: -font "obliqueLabelFont" -collapsable true;
4: columnLayout;
5: button;
6: button;
7: button;
8: showWindow;
TabLayout
The tab layout allows you to organize other layouts into a series of folders. All the children of a tabLayout must be layouts.
1: window;
2: string $tabs=`tabLayout`;
3: string $tab1=`columnLayout`;
4: button;
5: setParent ..;
6: string $tab2=`columnLayout`;
7: button;
8: setParent ..;
9: tabLayout -edit
10: -tabLabel $tab1 "Colors"
11: -tabLabel $tab2 "Flavors"
12: $tabs;
13: showWindow;
ScrollLayout
1: window;
2: scrollLayout;
3: columnLayout;
4: button;
5: button;
6: button;
7: button;
8: showWindow;
MenubarLayout
1: window;
2: menuBarLayout;
3: menu -label "File";
4: menuItem -label "Exit";
5: menu -label "Help" -helpMenu true;
6: menuItem -label "About...";
7: setParent ..;
8: string $tabs=`tabLayout`;
9: string $tabl=`menuBarLayout`;
10: menu -label "colors";
11: menuItem -label "Red";
12: menuItem -label "Green";
13: menu -label "Flavors";
14: menuItem -label "Vanilla";
15: menuItem -label "Chocolate";
16: tabLayout -edit -tabLabel $tabl "Confectionary" $tabs;
17: showWindow;
2万+

被折叠的 条评论
为什么被折叠?



