PDA

View Full Version : optionMenu alignment


mccollom73
09-26-2010, 09:49 PM
Hey,

So, I finally got my optioMenu to work, but it puts it way the heck out there and I would like it on the left side. Theres apic to show you, and here's my code.



if(`window -ex Riggit`) deleteUI Riggit ;

//Create a window with two option menu groups.
string $window = `window -title "Riggit"`;
columnLayout;

//Create a couple of option menu groups.
string $fingers = `optionMenuGrp -label "Fingers" fing`;
menuItem -label "1" ;
menuItem -label "2" ;
menuItem -label "3" ;
menuItem -label "4" ;
menuItem -label "5" ;

string $toes = `optionMenuGrp -label "Toes" toe`;
menuItem -label "1";
menuItem -label "2";
menuItem -label "3";
menuItem -label "4";
menuItem -label "5";

string $face = `optionMenuGrp -label "Face" fac`;
menuItem -label "Yes";
menuItem -label "No";



I tried using the -cal tag, but no luck. Thank you.

Josh

NaughtyNathan
09-27-2010, 11:15 AM
Hey Josh, whenever you use a ___Grp control you'll need to use some, if not all, of it's column layout flags. This is because the Grp controls are actually rowLayouts that require proper formatting. e.g.:

string $fingers = `optionMenuGrp -cw2 50 50 -label "Fingers" fing`;Another annoying thing to remember concerning optionMenu controls specifically is that they cannot be correctly assigned a width. an OptionMenu always resizes to fit the longest menuItem label. However, you can fool it by padding one of your menuItem labels with spaces. For example, if you change -label "1" into: -label "______1" then you can manually control the menu width. (change those _ to spaces, CGTalk forum doesn't like spaces). pretty lame, but better than nothing.

:nathaN

mccollom73
09-27-2010, 06:15 PM
Hey Josh, whenever you use a ___Grp control you'll need to use some, if not all, of it's column layout flags. This is because the Grp controls are actually rowLayouts that require proper formatting. e.g.:

string $fingers = `optionMenuGrp -cw2 50 50 -label "Fingers" fing`;Another annoying thing to remember concerning optionMenu controls specifically is that they cannot be correctly assigned a width. an OptionMenu always resizes to fit the longest menuItem label. However, you can fool it by padding one of your menuItem labels with spaces. For example, if you change -label "1" into: -label "______1" then you can manually control the menu width. (change those _ to spaces, CGTalk forum doesn't like spaces). pretty lame, but better than nothing.

:nathaN

It's so beautiful! Thank you, I used -cw but that didn't work, I guess I should randomly put numbers infront of tags if they don't work.

Do you know any good books that I can study from? You seem to know way to much about MEL. Any suggestions? Thanks!

Josh

NaughtyNathan
09-27-2010, 10:34 PM
I've never read any actual books on MEL Josh, I started learning by asking questions on highEnd3d (really dumb ones!) then when I grasped the basics I learned everything else I know simply by looking at Bryan Ewert's, Jeff Dobson's and Maya's internal scripts. Believe it or not, you can learn a hell of a lot just by opening up Maya's own MEL scripts, and they are very well commented too in a lot of places...

Also reading Maya's built-in MEL command documentation. Despite being lacking in a lot of ways, the MEL documentation is actually pretty comprehensive when it comes to figuring out how to work most commands (i.e. the optionMenuGrp docs do tell you that you have to give integer values to the -cw flag to denote columns and sizes.. :) )

Just keep asking Qs here (your Qs are probably going to help future readers anyway) and despite what some users may say on other posts, there are plenty of us who are happy to keep "wasting" our time helping others for free... ;)

:nathaN

mccollom73
09-28-2010, 05:44 AM
I've never read any actual books on MEL Josh, I started learning by asking questions on highEnd3d (really dumb ones!) then when I grasped the basics I learned everything else I know simply by looking at Bryan Ewert's, Jeff Dobson's and Maya's internal scripts. Believe it or not, you can learn a hell of a lot just by opening up Maya's own MEL scripts, and they are very well commented too in a lot of places...

Also reading Maya's built-in MEL command documentation. Despite being lacking in a lot of ways, the MEL documentation is actually pretty comprehensive when it comes to figuring out how to work most commands (i.e. the optionMenuGrp docs do tell you that you have to give integer values to the -cw flag to denote columns and sizes.. :) )

Just keep asking Qs here (your Qs are probably going to help future readers anyway) and despite what some users may say on other posts, there are plenty of us who are happy to keep "wasting" our time helping others for free... ;)

:nathaN

Well thank you for everything, you have been a huge help. I will start looking at other scripts to learn more. Actually, I have been doing that and I have learned a bit about MEL.

So, what your saying are my questions are dumb? Just kidding, ya I know my questions are very simple, but they trhough me for a loop.

CGTalk Moderation
09-28-2010, 05:44 AM
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.