PDA

View Full Version : Image won't appear in GUI


mccollom73
02-20-2011, 05:53 AM
I got it to work without anything else, but when I throw some buttons into it, it doesn't work. Also, I tried to place it in different lines to see if that was the problem, and that didn't work either. here the code:



global proc GUI()
{
int $width=380;
int $height=525;
string $title="Controller Window";

if(`window -q -exists GUIWin`)
{
deleteUI GUIWin;
}

string $win= `window -wh $width $height -title $title -retain GUIWin`;
string $tabs =` tabLayout -innerMarginWidth 5 -innerMarginHeight 5` ;

// for each tab add a columnLayout
string $tab1 = `columnLayout -w $width -h $height -adj 0 Body`;
string $form = `formLayout`;

// SEARCH AND FIND "NAME" AND REPLACE IT WITH CHARACTERS NAME
// BODY STRINGS
string $shoulder = `iconTextButton -style "iconOnly" -mw 0 -mh 0 -image1 "C:\\GUIButtons\\lButton.bmp" -w 20 -h 20 -command "string $object= \"Name_L_fkShoulder_JNT\"; int $mods = `getModifiers`; if (($mods/1)%2==1)select -add $object;else select $object;"`;
string $elbow = `iconTextButton -style "iconOnly" -mw 0 -mh 0 -image1 "C:\\GUIButtons\\rButton.bmp" -w 20 -h 20 -command "string $object= \"Name_L_fkElbow_JNT\"; int $mods = `getModifiers`; if (($mods/1)%2==1)select -add $object;else select $object;"`;
string $wrist = `iconTextButton -style "iconOnly" -mw 0 -mh 0 -image1 "C:\\GUIButtons\\lButton.bmp" -w 20 -h 20 -command "string $object= \"Name_L_fkWrist_JNT\"; int $mods = `getModifiers`; if (($mods/1)%2==1)select -add $object;else select $object;"`;

string $BodyImage = `image -i "MainFront.bmp"`;


formLayout -edit
// BODY BUTTONS
-attachForm $BodyImage "top" 1
-attachForm $shoulder "top" 152
-attachForm $elbow "top" 170
-attachForm $wrist "top" 190

-attachForm $BodyImage "top" 1

$form;

setParent..;
setParent..;

string $tab2 = `columnLayout -w $width -h $height -adj 0 Hands`;
string $form1 =`formLayout`;



$form1;

setParent..;
setParent..;

setParent $tabs;
showWindow $win;

}


thanks everyone.

Josh

NaughtyNathan
02-20-2011, 11:38 AM
your code has syntax errors... is that your issue? the line:
$form1;is garbage, you need to completely remove it.
or is your issues the draw order of the image/controls?

as a totally unrelated tip, I would never bother putting a formLayout under a columnLayout...
:nathaN

mccollom73
02-20-2011, 06:19 PM
The code works, I had much more code for this, but I just copied a few lines of it. I may have copied it wrong. The issues is with the drawing order of the buttons and images. It displays the buttons, but not the image.

I will get rid of the formLayout, thank you. :)

Josh

giordi
02-20-2011, 07:04 PM
if yo post a screen might be easier to visualize the code

mccollom73
02-20-2011, 07:10 PM
Heres a screen shot of the tab I would like the image to b in. I want it to be like a background image.

NaughtyNathan
02-20-2011, 07:29 PM
I will get rid of the formLayout, thank you. :)Sorry Josh, I wasn't too clear I guess.. it's the columnLayout you'd be better off without in this situation! ;)

mccollom73
02-20-2011, 07:35 PM
Sorry Josh, I wasn't too clear I guess.. it's the columnLayout you'd be better off without in this situation! ;)

Awesome thanks. Would this be the reason the image isnt't appearing?

Josh

giordi
02-20-2011, 07:50 PM
actually there is no need to you to set the position in the form layout of the image . you can just work on the form layout ( add all the buttons ) then add the image and then move the buttons . that s what i did and it work great . also you can watch the mel for animators dvd by gnomon it will be helpfull

mccollom73
02-20-2011, 07:58 PM
actually there is no need to you to set the position in the form layout of the image . you can just work on the form layout ( add all the buttons ) then add the image and then move the buttons . that s what i did and it work great . also you can watch the mel for animators dvd by gnomon it will be helpfull

How would I go about moving the buttons like that? The way I'm doing it is the only way I know how to place buttons where I want them.

Thanks for the replies guys.

Josh

mccollom73
02-23-2011, 01:45 AM
I finally tried this in 2010. It works great in 2010 but when I load it in 2011 it doesn't work at all. Any thoughts?

NaughtyNathan
02-23-2011, 10:16 AM
Most MEL-based UI stuff doesn't work 100% properly in 2011.. :(
my advice is to wait for 2012 and keep your fingers tightly crossed..
:nathaN

giordi
02-23-2011, 01:58 PM
How would I go about moving the buttons like that? The way I'm doing it is the only way I know how to place buttons where I want them.

Thanks for the replies guys.

Josh
well actually you can specify the image later or before and set parent to the layout you want . try that it might work. also be sure the path of the image is correct

CGTalk Moderation
02-23-2011, 01:58 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.