PDA

View Full Version : window size issue


doffer
03-01-2011, 08:23 AM
Hi guys
I'm trying to make a little rig GUI with a window containing a background image, and then a few buttons placed correctly to correspond to the controls on the rig.
I want to lock the size of the window, as I can't really figure out how to allow for scale, and then make everything scale relatively, so they remain positioned correctly - any tips on that?

Anyhow, I've lock the scale but for some reason I cannot control the size of the window, and it doesn't really match my background picture, making it appear stretched.

the code is like this:

//Make the window appear
int $windowWidth = 300;
int $windowHeight = 600;
string $w_title = "RigGUI";

if (`window -exists $w_title`)
{
deleteUI $w_title;
}
window
-wh $windowWidth $windowHeight
-s false
-t "Rig GUI"
$w_title;
formLayout body_frm;
string $i = `image -i "GUIPose.bmp"`;
string $bLelbow = `button -label "" -w 20 -h 20 -bgc 0.3 0.3 .8 -c "LeftElbow()"`;
string $bLwrist = `button -label "" -w 20 -h 20 -bgc 0.3 0.3 .8 -c "LeftWrist()"`;
setParent ..;
formLayout -e
-af $i top 0 -af $i left 0 -af $i right 0 -af $i bottom 0
-af $bLelbow top 240 -an $bLelbow left -af $bLelbow right 90 -an $bLelbow bottom
-af $bLwrist top 320 -an $bLwrist left -af $bLwrist right 60 -an $bLwrist bottom
body_frm;

//Set window width and height
window -e -wh $windowWidth $windowHeight $w_title;
showWindow $w_title;





As you can tell, I'm not much af a scripter, so I just tried to piece it together by looking at examples and stuff.
The background picture is 300 by 600, so that is what I want my window to be as well.


Any tips?


Cheers

dbsmith
03-01-2011, 07:07 PM
Just one tip, which i remember working for me back in the day - try editing your window size AFTER the showWindow call...

CGTalk Moderation
03-01-2011, 07:07 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.