PDA

View Full Version : textFieldGrp issue with formLayout


JakeLV426
09-03-2010, 05:44 PM
Hi, i'm trying to build some UI's to exercise my formLayout knowledge, but i'm running into some
problems. It seems that no matter what commands I use to place some textFieldGrp entries into
my window, they stubbornly refuse to register themselves to the left side of my layout, although
they are attached to it. Is this a textFieldGrp specific thing? I have no problem getting buttons where
I want them.
I realize this probably stinks of noob coder, so thanks for your patience!

//------------------------------------------------------------------------------
global proc arcWelder()
{
if (`window -exists awUI`)
deleteUI awUI;

window
-title "Jake's ArcWelder"
-wh 125 175
-mxb off
-mnb off
-resizeToFitChildren 1
-sizeable 1
awUI;

columnLayout -adj 1 mainCol;
formLayout arcWeldForm;

//START formLayout Content


button -l "Mirror and Weld" -c arcWeldX mirrorWeldButton;
button -l "Mirror Only" -c arcMirrorX mirrorOnlyButton;
textFieldGrp -l "Search:" searchTextField;
textFieldGrp -l "Replace:" replaceTextField;

formLayout -e


-af mirrorWeldButton top 5
-af mirrorWeldButton left 0
-af mirrorWeldButton right 0

-ac mirrorOnlyButton top 5 mirrorWeldButton
-af mirrorOnlyButton left 0
-af mirrorOnlyButton right 0

-ac searchTextField top 5 mirrorOnlyButton
-af searchTextField left 0
-af searchTextField right 0

-ac replaceTextField top 5 searchTextField
-af replaceTextField left 0
-af replaceTextField right 0

arcWeldForm;

windowPref -remove awUI;
showWindow awUI;
window -e -w 125 -h 200 awUI;
}

NaughtyNathan
09-03-2010, 06:36 PM
All the Grp controls are actually rowLayout parents with standard children, so even when you use one in a formLayout, you still have to set all of it's own -columnXXX flags to organize and align it's parts correctly.

:nathaN

JakeLV426
09-03-2010, 08:07 PM
Nathan, could you elaborate a little on the "set all of it's own -columnXXX flags" part?

Diamant
09-03-2010, 11:11 PM
Hey Jake.. take a look at this to help.. you also have some things in your code that you dont need which i took out such as columnLayout -adj 1 mainCol; .. no need to do that if you are using a form layout.. unless you didn't put the code in that uses it.. also i'm not sure why you are doing this.. windowPref -remove awUI; .. can be dangerous if its not there to begin with.. it will just error out.. if you are trying to get the window to be the same size each time you start it, just manually edit the size before or after you show the window..

-Rich


//------------------------------------------------------------------------------
global proc arcWelder()
{
if (`window -exists awUI`)
deleteUI awUI;

window
-title "Jake's ArcWelder"
-wh 125 175
-mxb off
-mnb off
-resizeToFitChildren 1
-sizeable 1
awUI;

formLayout arcWeldForm;

//START formLayout Content

button -l "Mirror and Weld" -c arcWeldX mirrorWeldButton;
button -l "Mirror Only" -c arcMirrorX mirrorOnlyButton;
textFieldGrp -l "Search:" -cw2 50 100 searchTextField;
textFieldGrp -l "Replace:" replaceTextField;

formLayout -e


-af mirrorWeldButton top 5
-af mirrorWeldButton left 0
-af mirrorWeldButton right 0

-ac mirrorOnlyButton top 5 mirrorWeldButton
-af mirrorOnlyButton left 0
-af mirrorOnlyButton right 0

-ac searchTextField top 5 mirrorOnlyButton
-af searchTextField left 0
-af searchTextField right 0

-ac replaceTextField top 5 searchTextField
-af replaceTextField left 0
-af replaceTextField right 0

arcWeldForm;

showWindow awUI;
window -e -w 125 -h 200 awUI;
}

NaughtyNathan
09-03-2010, 11:53 PM
Nathan, could you elaborate a little on the "set all of it's own -columnXXX flags" part?

yeah, all the Grp controls have a lot of flags that start with -column, i.e. -columnWidth, -columnOffset, etc... you need to use at least some of these (see how Rich has done in his example)

:nathaN

JakeLV426
09-09-2010, 01:14 AM
Hey Rich, good to hear from you again. I think I was working on this same script when I was taking your class back when...thanks for the help. I Finally had some time to start getting back into scripting...and starting where I left off seemed logical. How's ND life?

For this: windowPref -remove awUI;
I think I was a little confused by some of the info in the UI building Sticky on this forum, a couply of guys mentioned that there was something regarding resetting the windowPref every time you create a window? I added it because even though I was defining the -wh 125 175, Maya didn't seem to give a damn how big I wanted my window...I think I misread something. Anyway, I'll stay away from that one. I can see that the -cw2 flag was the key to getting my textFieldGrp items to stick to the left side of the formLayout, I checked out the Maya help and saw all the columnXXX flags you mentioned, makes sense now.

One question I still have though, is that if I turn on sizeable, why doesn't the textFieldGrp stick to the right side of the formLayout, since i've added -af replaceTextField right 0 ? It seemed to do what it was supposed to on my buttons, stretching them to the edge of the form.
Thanks Nate and Rich for being so helpful with my noob stankin code :beer:

NaughtyNathan
09-09-2010, 09:23 AM
I can't be certain as I don't have your updated code Jake, but I'm guessing you need to designate one of your textFieldGrp columns as being -adjustable.

:nathaN

ewerybody
09-09-2010, 10:19 AM
jep its -adjustableColumn or -adj with the index. In your case 2:textFieldGrp -l "Search:" -cw 1 60 -adj 2 searchTextField;
textFieldGrp -l "Replace:" -cw 1 60 -adj 2 replaceTextField;

JakeLV426
09-10-2010, 05:21 PM
-adj 2 was the magic flag! Thanks ewery!

CGTalk Moderation
09-10-2010, 05:21 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.