View Full Version : Basic UI Mel


rookie101
11 November 2012, 12:57 PM
Hey how would I get this to all be on the same line in the ui. Oh and when ever I use the width and height flags for the window command it never actually adjusts to it, why is that?


global proc linkWin()
{

if (`window -ex linkWin`) deleteUI linkWin;
window -title "Light Linker" -width 500 -h 40 linkWin;
columnLayout -adj false;

text -label "Light" -align "left";
text -label "Object" -align "right";

button
-label "Attach" -align "center" -w 70 ;

button
-label "Deattach" -align "center" -w 70;
textField -tx "";
textField -tx "";
showWindow linkWin;
};

linkWin();

Prequel
11 November 2012, 01:09 PM
Check out rowLayout to keep all elements in one row.

NaughtyNathan
11 November 2012, 05:01 PM
if you want UI controls organized in a line (row) rather than in a single column, you use a rowLayout rather than a columnLayout.

You also have a preference setting which makes Maya remember the size and position of all windows. You can:

1) turn this option off (not recommended),
2) delete the .mel file that stores the window settings: windowPrefs.mel (not recommended) or
3) manually remove the prefs for a given window using the windowPref command.
windowPref -remove linkWin;
I recommend putting this command into your script while you develop the UI and then remove it when you are happy with the window size and layout.

rookie101
11 November 2012, 10:40 PM
Thank alot for the help. I was able to finish my little script. Is there anything I did in the script that you would do differently? I was trying to find a way to get the -dgc and -dpc flags working for the textfield but couldn't get it to work.





//// attach light to object command
global proc attLight()
{
string $curLight = `textField -q -tx light`;
string $curObj = `textField -q -tx object`;

lightlink -make -light $curLight -object $curObj;
}


//// deattach light from object command
global proc deattLight()
{
string $curLight = `textField -q -tx light`;
string $curObj = `textField -q -tx object`;
lightlink -b -light $curLight -object $curObj;
}



global proc linkWin()
{
if (`window -ex linkWin`) deleteUI linkWin;
window -title "Light Linker" -width 900 -h 50 -s false linkWin;
rowLayout -numberOfColumns 6 -adjustableColumn 2 -columnWidth6 26 100 20 30 35 1;

text -label "Light:" -align "center" -w 35;

textField -tx "" -w 150 light;

button
-label "Attach"
-align "center"
-w 70
-c "attLight()" ;
button
-label "Deattach"
-align "center"
-w 70
-c "deattLight()";

text -label " Object:" -align "center" -w 35;

textField -tx "" -w 150 object;


windowPref -remove linkWin;

showWindow linkWin;
};

linkWin();

CGTalk Moderation
11 November 2012, 10:40 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.


1