|Class||public class SizeMode|
SizeModeclass contains the constant values that define the component sizing mode when being laid out in a container.
sizeUnit properties determine the size of the child component, or rather, the amount of space the
child component will take up within the parent container. For example, if a child component's
size property is set to
sizeUnit is set to
the child component will take up 50% of the parent container. The default value of
sizeUnit is pixels.
Flow size versus opposite-flow size
A container can set the size of each subcomponent in the direction of the flow (i.e. height in a container with vertical flow), only if the subcomponent implements the IContainable interface and only if IContainable.size is not 0. Otherwise, the subcomponent's dimensions are not changed during a layout operation. This is referred to as the flow size.
A container can set the size of a subcomponent in the direction opposite to
the container flow (height in a horizontal container, width in a vertical container) only if the subcomponent implements IContainable and IContainable.sizeMode is set
SizeMode.BOTH. This is referred to as the opposite-flow size. When this property is set, the subcomponent will fill the remaining container space (in the direction opposite to the flow of the container) and the
container's align setting will be ignored.
The following illustration shows the flow size and opposite-flow size of subcomponents as it relates to the flow direction of a parent container:
In the sample application (which is included with the
Container class documentation), the Back button uses the
SizeMode property to fill out the opposite direction in the bottom container. In other words, after a layout call, the
button will expand vertically (note that the container uses a horizontal flow) to fill the space in the bottom container:
leftButton = new LabelButton(); leftButton.label = "Back"; leftButton.size = 100; leftButton.sizeUnit = SizeUnit.PIXELS; leftButton.sizeMode = SizeMode.BOTH;
Note that you must specify a size for the component (using the
size property) otherwise the component will not resize when a layout call occurs. For the sake of the
example, the Next button does not specify the
rightButton = new LabelButton(); rightButton.label = "Next"; rightButton.size = 100;
The code listings above create the following buttons:
|PlayBook Tablet OS Version: 1.0.6|
|BOTH : String = both|
[static] A constant representing component sizing of the component in both the flow and opposite flow directions.
|FLOW : String = flow|
[static] A constant representing component sizing only in the direction of the container's flow.