
CHAPTER 4: User-Interface Tools Automatic layout 89
If you set the alignment value using a constant and then query the property, it returns an index number
corresponding to the constant, rather than a string value.
Elements in a row can be aligned along the vertical axis, in these ways:
X top — The element’s top edge is located at the top margin of its container.
X bottom — element’s bottom edge is located at the bottom margin of its container.
X center — The element is centered within the top and bottom margins of its container.
X fill — The element’s height is adjusted to fill the height of the container between the top and
bottom margins.
Elements in a column can be aligned along the horizontal axis, in these ways:
X left — The element’s left edge is located at the left margin of its container.
X right — The element’s right edge is located at the right margin of its container.
X center — The element is centered within the right and left margins of its container.
X fill — The element’s width is adjusted to fill the width of the container between the right and left
margins.
Elements in a stack can be aligned along either the vertical or the horizontal axis, in these ways:
X top — The element’s top edge is located at the top margin of its container, and the element is
centered within the right and left margins of its container.
X bottom — element’s bottom edge is located at the bottom margin of its container, and the element is
centered within the right and left margins of its container.
X left — element’s left edge is located at the left margin of its container, and the element is centered
within the top and bottom margins of its container.
X right — The element’s right edge is located at the right margin of its container, and the element is
centered within the top and bottom margins of its container.
X center — The element is centered within the top, bottom, right and left margins of its container.
X fill — The element’s height is adjusted to fill the height of the container between the top and
bottom margins., and the element’s width is adjusted to fill the width of the container between the
right and left margins.
The following figure shows the results of creating the sample window with row orientation and the
bottom and top alignment settings in the parent’s alignChildren property:
The following figure shows the results of creating the sample window with column orientation and the
right, left, and fill alignment settings in the parent’s alignChildren property. Notice how in the
fill case, each element is made as wide as the widest element in the container:
Comentarios a estos manuales