FORUMS: list search recent posts

Melscript: formLayouts in tabLayouts with frameLayouts?

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Jacqueline Johnsen
Melscript: formLayouts in tabLayouts with frameLayouts?
on Feb 16, 2013 at 10:44:44 pm

Been trying to get my buttons to co-exists neatly with my other stuff in a melscript GUI. I really want to use "formLayout" to get everything where I want it to go, but I can't get it to work with my "tabLayout".
{
window;

tabLayout;
columnLayout Tab1;
formLayout -numberOfDivisions 100 myForm;

button -label "button1" -width 70 -command "button1command" myBtn1;
button -label "button2" -width 70 -command "button2command" myBtn2;

formLayout -edit
-attachForm myBtn1 "top" 10
-attachForm myBtn1 "left" 10
-attachForm myBtn2 "top" 50
-attachForm myBtn2 "left" 50
myForm;

setParent..;
columnLayout tab2;
text -l "This is a text to show the problems with the layout.";


showWindow;
}
proc button1command()
{setAttr "EyeRamp.colorEntryList[2].color" 0.11172 0.146034 0.798;}

proc button2command()
{setAttr "EyeRamp.colorEntryList[2].color" 0.344172 0.344363 0.348;}

This example script will show 2 tabs if you remove the form script parts.

Now I've done a lot of research (and testing) and I think "FrameLayout" might solve this issues, but I can't find any examples with framelayouts without the collapsable menus (and I'm using tabs). And I'm really lost.
Can anyone help? It would be greatly appreciated. ^^
Take care!
J.


Return to posts index

Lee Marsland
Re: Melscript: formLayouts in tabLayouts with frameLayouts?
on Feb 22, 2013 at 7:01:01 pm

Is there any particular reason for the formLayout?
if not, use a gridLayout

change

formLayout -numberOfDivisions 100 myForm;

to

gridLayout -nrc 2 2 -cw 70 myForm;

and get rid of


formLayout -edit -attachForm myBtn1 "top" 10 -attachForm myBtn1 "left" 10 -attachForm myBtn2 "top" 50 -attachForm myBtn2 "left" 50 myForm;

This puts the two buttons side by side, was this what you wanted?
Hope this helps, wasn't sure I understood your original question


Return to posts index

Jacqueline Johnsen
Re: Melscript: formLayouts in tabLayouts with frameLayouts?
on Mar 2, 2013 at 10:45:35 am

Yeah it places the buttons next to eachother but it also breaks my tabLayout.
Here's the script with working tabLayouts:
(2 tabs with each 2 buttons)$win = `window -t "tab layout"`;

tabLayout;

columnLayout tab1;
button -label "button1" -width 70 -command "button1command" myBtn1;
button -label "button2" -width 70 -command "button2command" myBtn2;
setParent..;

columnLayout tab2;
button -label "button3" -width 70 -command "button3command" myBtn3;
button -label "button4" -width 70 -command "button4command" myBtn4;

showWindow $win;


Here's the script with the buttons placed next to eachother which breaks the tabLayout:$win = `window -t "tab layout"`;

tabLayout;

columnLayout tab1;
gridLayout -nrc 2 2 -cw 70 myForm;
button -label "button1" -width 70 -command "button1command" myBtn1;
button -label "button2" -width 70 -command "button2command" myBtn2;
setParent..;

columnLayout tab2;
button -label "button3" -width 70 -command "button3command" myBtn3;
button -label "button4" -width 70 -command "button4command" myBtn4;

showWindow $win;


Return to posts index



Lee Marsland
Re: Melscript: formLayouts in tabLayouts with frameLayouts?
on Mar 3, 2013 at 5:24:59 pm

I just checked it out real quick, simple fix.
As you added another Layout, it has been buried another layer, so you need to add another setParent..;
it would read

$win = `window -t "tab layout"`;

tabLayout;

columnLayout tab1;
gridLayout -nrc 2 2 -cw 70 myForm;
button -label "button1" -width 70 -command "button1command" myBtn1;
button -label "button2" -width 70 -command "button2command" myBtn2;
setParent..;setParent..;

columnLayout tab2;
button -label "button3" -width 70 -command "button3command" myBtn3;
button -label "button4" -width 70 -command "button4command" myBtn4;

showWindow $win;


This keeps both your tabs as well as places the buttons side by side, if you wanted you can still add a gridLayout to your second tab.

Hope this helps,

Lee


Return to posts index

Jacqueline Johnsen
Re: Melscript: formLayouts in tabLayouts with frameLayouts?
on Mar 5, 2013 at 8:56:21 am

Heheh... Wow that was simple... My poor brain is probably on strike. But thanks a lot! My GUI Looks so pretty now!
Oh I had some issues with getting the other elements after the button on the same tab. But then my brain started functioning again and I simply placed the setparent before the other element which worked. I think I'm not used anymore to easy things... :D
So here it is, if someone is curious.$win = `window -t "tab layout"`;

tabLayout;

columnLayout tab1;
gridLayout -nrc 2 2 -cw 70 myForm;
button -label "button1" -width 70 -command "button1command" myBtn1;
button -label "button2" -width 70 -command "button2command" myBtn2;
setParent..;
text -l "This is not a button";

setParent..;

columnLayout tab2;
button -label "button3" -width 70 -command "button3command" myBtn3;
button -label "button4" -width 70 -command "button4command" myBtn4;

showWindow $win;


Again thank you so much! XD


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]