Thanks for your answer again, Don.
The code I've pasted is a sketch of the real function. The For-Loop calls a function that declares the panel and initializes it, among 140 lines of code of many other stuff (heights, widths, colors), so at the end the panel is inside the loop. Sorry for misleading you.
Another doubt I have: would it be more efficient (fast?) to set widths and heights in the layout's script, or in code, as in the example?
Thank you very much!