PDA

View Full Version : Help please with GUI problem


amreet
05-01-2006, 12:30 PM
i want to find out how to create a 'unroll' feature using MEL.
this is a bit hard to describe without showing a pic....u know in some apps when u click a separator like line, it unfolds itself to reveal some hidden buttons, or a new menu set....?? thats what im looking to do in my script. i already have a window with some buttons on it, but i would like to hide that portion of UI. so using a rollup feature would be very useful.

anyone have any ideas???


edit: i just realised it...click my username on the right. it rolls out a menu. thats sort of what im on about.

thanks
slider17

mhovland
05-01-2006, 12:55 PM
You need to look at the frameLayout control. It does just what you need.

amreet
05-01-2006, 01:00 PM
thanks for the quick reply..

had a peek at the MEL command ref.

im guessing this is what i need to look at:

-collapseCommand (-cc) stringhttp://localhost:4449/Maya7.0/en_US/gfx/create.gifhttp://localhost:4449/Maya7.0/en_US/gfx/edit.gif Command executed after the frame is collapsed. -expandCommand (-ec) stringhttp://localhost:4449/Maya7.0/en_US/gfx/create.gifhttp://localhost:4449/Maya7.0/en_US/gfx/edit.gif Command executed after the frame is expanded. -collapse (-cl) booleanhttp://localhost:4449/Maya7.0/en_US/gfx/query.gifhttp://localhost:4449/Maya7.0/en_US/gfx/create.gifhttp://localhost:4449/Maya7.0/en_US/gfx/edit.gif Collapse state of the frame layout. -collapsable (-cll) booleanhttp://localhost:4449/Maya7.0/en_US/gfx/query.gifhttp://localhost:4449/Maya7.0/en_US/gfx/create.gifhttp://localhost:4449/Maya7.0/en_US/gfx/edit.gif Collapsibility of the frame layout.
anyone know where i can find some examples on the net???


thanks again
slider17

goleafsgo
05-01-2006, 01:49 PM
You don't actually have to handle the collapsing yourself with that flag. If you already have some UI then just wrap it in one of those layouts and it should just work. If you want the starting state to be closed then you would have to use that flag to start it that way.

amreet
05-01-2006, 02:24 PM
You don't actually have to handle the collapsing yourself with that flag. If you already have some UI then just wrap it in one of those layouts and it should just work. If you want the starting state to be closed then you would have to use that flag to start it that way.

would u be so kind and show me an example....

i have an idea but need some further help.

thanks
slider17

Starrider
05-01-2006, 02:36 PM
this should work:

window;
scrollLayout scrollLayout;
columnLayout -adjustableColumn true;
frameLayout -label "Buttons" -labelAlign "top" -borderStyle "in" -collapsable 1;
columnLayout;
button; button; button;
setParent ..;
setParent ..;
setParent ..;
setParent ..;
showWindow;

amreet
05-01-2006, 02:50 PM
this should work:

window;
scrollLayout scrollLayout;
columnLayout -adjustableColumn true;
frameLayout -label "Buttons" -labelAlign "top" -borderStyle "in" -collapsable 1;
columnLayout;
button; button; button;
setParent ..;
setParent ..;
setParent ..;
setParent ..;
showWindow;

thanks for that Starrider, ive implemented your idea into my script and it works just as i imagined.!
one thing left to sort out, and that is what code do i use so when the ui is first displayed the frame is collapsed (hidden).
also, why do u have 4 setParent ..; commands?? i used just the one in my script and i have 5 buttons in their.

cheers
slider17

Starrider
05-01-2006, 03:04 PM
when you create layouts you build up a hierarchy and every new layout is installed as the child of the actual layout. to get up in the hierarchy you have to use setParent ..;
in our case here you could just ignore it because no other ui-elements are built and everything works fine without the setParents. but if you would add additional ui-s you would have to walk up with setParent until you were at the right position where you wanted to insert them.
maybe this formated code explains it better:

window;
scrollLayout scrollLayout;
columnLayout -adjustableColumn true;
frameLayout -label "Buttons" -labelAlign "top" -borderStyle "in" -collapsable 1;
columnLayout;
button; button; button;
setParent ..;
setParent ..;
setParent ..;
setParent ..;
showWindow;

Starrider
05-01-2006, 03:06 PM
ah - i forgot:
you could also set the parent directly

window;
string $mainLayout = `scrollLayout scrollLayout`;
columnLayout -adjustableColumn true;
frameLayout -label "Buttons" -labelAlign "top" -borderStyle "in" -collapsable 1;
columnLayout;
button; button; button;



setParent $mainLayout;
showWindow;

ps: i didn't try it but it should work.

amreet
05-01-2006, 03:06 PM
yup that makes sense now....thanks mate

edit: second method looks cleaner, and it does work.

slider17

CGTalk Moderation
05-01-2006, 03:06 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.