///////////////////////////////////////////////////////////////////////////// // framebuttons.mel Version 1.0 by Andrew Osiow Copyright 2009 // // demo script for using buttons in the frame layout // ///////////////////////////////////////////////////////////////////////////// global proc framebuttons() {// opens a window with 2 frame layouts and two buttons each global int $framebuttonWinHeight; // delete any old Crystalball window preferences if (`windowPref -ex framebuttonsWindow`) windowPref -remove framebuttonsWindow; // delete any old Crystalball window structures if (`window -ex framebuttonsWindow`) deleteUI framebuttonsWindow; // create a window structure string $framebuttonsWin = `window -title "framebuttons v1.0" -iconName "framebuttons" -rtf 1 -s 0 // resize to fit - no size gadget framebuttonsWindow`; // create columns layout string $framebuttonsColumns = `columnLayout -adj 1`; // create frame 01 layout string $framebuttonsFrame1 = `frameLayout -w 312 -h 50 -l "Poly Button 1" -cll 1 -mw 4 -bs "in" -cc "window -e -h ($framebuttonWinHeight-30) framebuttonsWindow; $framebuttonWinHeight -= 28" -ec "window -e -h ($framebuttonWinHeight+30) framebuttonsWindow; $framebuttonWinHeight += 28"`; string $framebuttonsGrid1 = `gridLayout -numberOfColumns 2 -cellWidthHeight 150 26`; button -width 150 -height 26 -label "Cube" -align "center" -command "cube" cubeButton01; button -width 150 -height 26 -label "Sphere" -command "sphere" sphereButton01; // create frame 02 layout setParent $framebuttonsColumns; string $framebuttonsFrame2 = `frameLayout -w 312 -h 50 -l "Poly Button 2" -cll 1 -mw 4 -bs "in" -cc "window -e -h ($framebuttonWinHeight-30) framebuttonsWindow; $framebuttonWinHeight -= 30" -ec "window -e -h ($framebuttonWinHeight+30) framebuttonsWindow; $framebuttonWinHeight += 30"`; string $framebuttonsGrid2 = `gridLayout -numberOfColumns 2 -cellWidthHeight 150 26`; button -width 150 -height 26 -label "Cube" -align "center" -command "cube" cubeButton02; button -width 150 -height 26 -label "Sphere" -command "sphere" sphereButton02; // display framebuttons Window showWindow $framebuttonsWin; $framebuttonWinHeight = `window -q -h framebuttonsWindow`; }