PDA

View Full Version : creating layouts


sevag00
04-03-2006, 04:45 PM
hey everyone, i have a question about creating layouts, what is the difference between this
string $child1 = 'columnLayout';
and by writing columnLayout
is there a difference

RyanT
04-03-2006, 05:38 PM
By saying string $child1 = 'columnLayout'; you are creating a variable that holds the name of the column. Reasons you might do this? In a longer script you might want to add more things to that column later in the script. You could now use this variable to do something like setParent $child1; A better way to do it though would be to define the columns name yourself. If you just says columnLayout; Maya gives it some generic name just like it does when you create a default nurbs sphere. Instead you could write columnLayout child1; Now the column is called child1. If you wanted to edit it you would know its name is child1.

Example:

string $window = `window -title "Child Window"`;
columnLayout child1;
showWindow $window;
setParent child1;
button -label "Default";


-RyanT

sevag00
04-03-2006, 06:11 PM
hey thanks, but i didn't understand the 2nd line where you said "child1", what is "child1" ?

goleafsgo
04-03-2006, 06:25 PM
When he called "columnLayout" he is providing a name for the layout.

If you don't provide a name then Maya will give it a name and the way to store the name that Maya assigns the control is to store it in the string variable. ie. Maya returns the name of the new control as a string.

sevag00
04-04-2006, 11:43 AM
musn't he put before child1 -title, for assigning a title?

Mikademius
04-04-2006, 12:05 PM
It's not a title, it's an ID

"layout" "flags" "ID"
so when you write :

columnLayout -width 100 child1;

child1 is just an ID for that layout. Say you want to know the with of that column later.

columnLayout -q -width child1;

Then you use the ID for that layout to find its width

sevag00
04-04-2006, 06:23 PM
but what is -q in that case?
in this code:
string $window = `window -title "Child Window"`;
columnLayout child1;
showWindow $window;
setParent child1;
button -label "Default";

if im gonna add in that code, the size of the window how can i add it?

Mikademius
04-04-2006, 09:18 PM
-q puts the layout in "querymode" which lets you gather information, in my case the width.
if you want to set the size of the window you add the flags -width and -height (or -wh)
You have to read through the document for that layout. Look up window in the MEL reference and check all the flags. Copy/paste the examples etc. Or you'll get nowhere ;)
And you might want to rewrite your code like this:


string $window = `window -title "Child Window"`;
columnLayout child1;
button -label "Default";
showWindow $window;


No need to show the window before the UI is defined.

CGTalk Moderation
04-04-2006, 09:18 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.