PDA

View Full Version : formLayout - use a for loop to layout tons of buttons?


PhillipCrond
09-16-2005, 07:23 PM
I'm writing a utility for work, and I need to layout a window with about 60 rows where you've got [checkbox, text field, text field] as the general arrangement.

I'm trying to do this with a formlayout, but in the "formLayout -edit", I'm not allowed to throw a loop in there. So how do I layout 60 identical things without copying and manually editing 60 -attachPositions?

Keep in mind, this is my first real scripting task...

Thanks!
Brent

PhillipCrond
09-16-2005, 08:01 PM
Ooops, got it. I didn't realize you can have as many formLayout commands as you want...

for ($i = 0; $i < $numRows; $i++){
formLayout -edit
-attachPosition $p2e_checkBox[$i] "top" 0 (($i * 7)+100)
-attachPosition $p2e_checkBox[$i] "bottom" 0 (($i * 7)+110)
-attachPosition $p2e_checkBox[$i] "left" 0 20
-attachPosition $p2e_checkBox[$i] "right" 0 40
$p2e_form;
}

CGTalk Moderation
09-16-2005, 08:01 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.