
CHAPTER 4: User-Interface Tools Managing control titles 99
X
The title property is a String that defines a text label for a UI element. The title can appear to the left or
right of the graphic element, above or below it, or superimposed over the center of the graphic
element; the placement is controlled by the titleLayout
property.
X The titleLayout property is an Object containing properties that specify:
Z The title's character width;
Z The title's justification within the character width;
Z How the title should be truncated if necessary;
Z The orientation, alignment, and spacing of the title with respect to the object it identifies;
Z The margins within the virtual container that surrounds the title and its related object.
All
titleLayout properties are optional; the element types that use this mechanism have default values
for each property. Complete details are provided in the reference section; see “
titleLayout” on page 141.
The following sections provide examples that show how to use title layout to achieve many different
layouts.
Title alignment and orientation
Unlike automatic layout, title layout uses the alignment property to specify the orientation of the title and
graphic element, and how the title aligns to the graphic element. This property contains a 2-element array,
where the first element specifies horizontal alignment and the second specifies vertical alignment. The
allowed values for these are the same as those used by automatic layout (see “
Aligning children” on
page 88), except that the fill value is not allowed.
X To achieve a row orientation where the title appears to the left or right of the graphic element, define
horizontal alignment as
left or right and vertical alignment as center, top, or bottom:
button.titleLayout = { alignment: ['right', 'center'] };
Comentários a estes Manuais