View Full Version : gridLayout sizing issues

01-06-2006, 11:14 PM
This is a question I've had open on the MEL UI Building sticky thread since about august, and the animators that I work with are starting to get a bit ansy. I figure I should give it another shot.

I have a script that dynamically creates a palette of buttons which allow the animators to click on a button and apply an animation file to the current scene. These buttons are arranged in a gridLayout. The gridLayout in the excerpt below has an unfortunate problem in that the area that it is displayed in relative to total screen area - i.e. if your monitor displays 1600x1200, you have no problem; if you are using an lcd monitor which displays 800x600, the palette is only a button and a half tall, which is unuseable for animators.

My solution is that I am trying to figure out how to get a grid of buttons (inside of a tab, which itself is inside of a columnLayout) to either display in a screen area that is resizeable (best), or at least hard coded, like a 300x300 field (tolerable).

Here is a simplification of what I have currently. The use of a scrollLayout->frameLayout->gridLayout is merely what I did to minimize the damage. I'll do anything as long as I can place a palette of buttons without sizing issues.

//populates the grid layout with a bunch of buttons determined at runtime
global proc MakeButtons()
for ($i=0; $i < 50; $i++)
string $itemname = string($i);
button -al left -ann $itemname -p "griddy" -label $itemname;

//for debugging purposes - find the area of the scroll area I am trying to fix
global proc ScrollResizeCommand()
int $value[] = `scrollLayout -query -scrollAreaValue "animscroll"`;
$value[2] = `scrollLayout -q -saw "animscroll"`;
$value[3] = `scrollLayout -q -sah "animscroll"`;

intField -e -v $value[0] scrolll;
intField -e -v $value[1] scrollt;
intField -e -v $value[2] scrollw;
intField -e -v $value[3] scrollh;

//makes a window with a grid inside of a tab inside of a column.
global proc MakeAWindow()
if (`window -q -ex layoutwin`) deleteUI layoutwin;

window -t "Button Palette" -mnb on -rtf true layoutwin;
columnLayout -columnAttach "both" 5 -adj true jm2al;
text -l ""; //place holder for other controls

$tabs = `tabLayout -cr true /*-scr true*/ -imh 5 -imw 5 -h 800 palettetab`;

// Animation tab 88888888888888888888888888888888888888888888888888
$animcol = `columnLayout -adj true animcol`;

rowLayout -nc 4
-cw 1 44 -cw 2 44 -cw 3 44 -cw 4 44 ;
intField -ed 0 -w 32 scrolll; //place holder for other controls
intField -ed 0 -w 32 scrollt;
intField -ed 0 -w 32 scrollw;
intField -ed 0 -w 32 scrollh;

//THIS IS THE PART THAT I WISH TO FIX ---------------------
string $animscroll;
$animscroll = `scrollLayout -cr true -h 800 animscroll`;
frameLayout AnimPalette;
gridLayout -autoGrow true -columnsResizable true -cellWidthHeight 100 25 -nr 25 griddy;
// END SECTION I WISH TO FIX ------------------------------

// Pose Tab 8888888888888888888888888888888888888888888888888888888
$posecol = `columnLayout -adj true posecol`;

text -l ""; //place holder for other controls

tabLayout -edit -tabLabel $animcol "Animations" -tabLabel $posecol "Poses" $tabs;
scrollLayout -edit -rc "ScrollResizeCommand()" animscroll;


//execute the script above

BTW, why is it that I can never get sections of code that are even mildly complicated to format correctly in this forum?

CGTalk Moderation
01-06-2006, 11:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.