Thursday, July 26, 2012

Something new

It's been a while, but since this is the first thing I have drawn in about a year and a half, I thought it was worth posting. Maybe it will be habit forming...

Monday, February 27, 2012

Defining PaneLayout borders for use with FormLayout

Hey Folks!

I am sorry for the lack of updates, I have been working lately in my free time (quite a lot, actually) but I haven't posted very much because I have mostly been working on my programming skills. Thus far, I have not been posting the programs and notes I have been writing since they are not as pretty as paintings or 3D models. However now I have decided that they I have been spending enough time working on them that I will begin posting some of the issues/solutions that I have been running into, in addition to any future paintings or 3D models. The blog is dead no longer.

And here, with the latest tidbit of information, is the solution to a problem that I ran into while Melscripting a program for work.

When you create your own custom windows with Mel, you use an assortment of layouts to position the objects (buttons, radio buttons, checkboxes etc.) in your window. One of the more useful types of layout is the "formLayout". This is a borderless "box" to contain your objects, and it lets you snap objects to specific points within it. a "paneLayout" lets you divide a window into two or more smaller windows with a moveable divider. Unfortunately I ran into a problem using the two together, until by chance I stumbled on a googlebook preview on rigging that had an example that used formLayouts embedded within paneLayouts. I promptly bought the book, and then I wrote the following example to illustrate how to do this. It turns out that all you need to do is create a separate procedure for each window that you want to use a formLayout in

I hope this saves somebody else the time, frustration, and trial and error that I went through trying to force this to work by other means.


proc panel01 (){

string $form = `formLayout -numberOfDivisions 100`;
string $button1 = `button -label "Execute"`;
string $button2 = `button -label "Exit"`;
setParent..;

formLayout -edit
-attachForm $button1 "bottom" 5
-attachForm $button1 "right" 5
-attachNone $button1 "top"
-attachPosition $button1 "left" 5 50

-attachForm $button2 "bottom" 5
-attachForm $button2 "left" 5
-attachNone $button2 "top"
-attachPosition $button2 "right" 5 50
$form ;
}


string $myWindow = `window`;
paneLayout -configuration "horizontal2";
//1st Pane
panel01;
setParent ..;
//2nd Pane
frameLayout;
button;
button;
button;
button;
setParent;
setParent..;
showWindow $myWindow;