If you are like me and enjoy laying out containers, the addstretch() function is very handy.
Thanks to Barry for pointing that out to me today.
Here is an example.
In my center container, I have two buttons that are added in a Horizontal layout. They are spaced evenly as you would expect.
If I add centercontainer.addstretch() before I add the buttons, it acts like a container and pushes the buttons to the bottom.
However, since I want the buttons centered, I add one call before the buttons are added, and one call after.
Very handy.
Code:
maincontainer.addObject("centercontainer","container")
centercontainer.layout = 2
centercontainer.autosize = 1
centercontainer.stylesheet="background-color:rgb(239,244,255)"
centercontainer.spacing = 10
centercontainer.padding = 10
centercontainer.margin = 10
centercontainer.addstretch()
centercontainer.addobject("button1","mybutton")
button1.caption = "Button One"
centercontainer.addobject("button2","mybutton")
button2.caption = "Button Two"
centercontainer.addstretch()
Herb
Bookmarks