lnLeft=0 for i=1 to this.buttoncount with this.buttons[i] if .visible .left=lnLeft .top=0 lnLeft=lnLeft+.width+1 && one pixel gap, if you like endif endwith endforThis would align visible buttons in one line. You could add similar code for the two row case (lnTop would be there, zero for 1st row, .height+1 for 2nd). You could have a property on the container which would indicate in how many rows does it go, then consult this property before running this code (in container's init). You'd only have to set that property for the container in those forms where it should have a non-default value.