Use forms to precisely place your objects in a window.
-formlayout
//create a formLayout, and series of buttons.
//edit the formLayout and place the buttons
//button 1 is linked to myaction1() which makes a sphere and turns the visibility of the remaining buttons on
//the remaining buttons are linked to myaction2() which makes different geometry.
{
global string $b2,$b3,$b4,$b5,$b6;
proc myaction1()
{
sphere -radius 1 -axis 0 90 0 -n ball;
button -edit -vis 1 $b2;
button -edit -vis 1 $b3;
button -edit -vis 1 $b4;
button -edit -vis 1 $b5;
button -edit -vis 1 $b6;
}
proc myaction2(int $myNum)
{
string $object[]=`ls -as`;
string $toMake[]={"polyCube","polyPlane","polyCylinder","polyTorus","polyCone"};
int $objsize = size($object);
for ($i =0; $i < $objsize;$i++)
{
if ($object[$i] == "ball")
{
eval $toMake[$myNum];
}
}
}
if (`window -exists mahwinder`)
{
deleteUI mahwinder;
windowPref -remove mahwinder;
}
window -widthHeight 200 200 mahwinder;
string $form = `formLayout -numberOfDivisions 100`;
string $b1 = `button -label "1" -c "myaction1()"`;
string $b2 = `button -label "2" -width 50 -vis 0 -c "myaction2(0)"`;
string $b3 = `button -label "3" -width 50 -vis 0 -c "myaction2(1)"`;
string $b4 = `button -label "4" -width 50 -vis 0 -c "myaction2(2)"`;
string $b5 = `button -label "5" -width 50 -vis 0 -c "myaction2(3)"`;
string $b6 = `button -label "6" -width 50 -vis 0 -c "myaction2(4)"`;
formLayout -edit
//place button 1
-attachForm $b1 "top" 50
-attachForm $b1 "left" 50
-attachForm $b1 "right" 50
-attachForm $b1 "bottom" 50
//place button 2
-attachForm $b2 "top" 0
-attachForm $b2 "left" 0
//place button 3
-attachForm $b3 "bottom" 0
-attachForm $b3 "left" 0
//place button 4
-attachForm $b4 "top" 0
-attachForm $b4 "right" 0
//place button 5
-attachForm $b5 "bottom" 0
-attachForm $b5 "right" 0
//place button 6
-attachForm $b6 "bottom" 0
-attachControl $b6 "right" 25 $b5
$form;
showWindow mahwinder;
};
|
<Top>