qnx.ui.core.SizeMode

SizeMode

Constants


Packageqnx.ui.core
Classpublic class SizeMode
InheritanceSizeMode Inheritance Object

The SizeMode class contains the constant values that define the component sizing mode when being laid out in a container.

The size and 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 50 and sizeUnit is set to SizeUnit.PERCENT 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 to 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:

Opposite size

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 Back 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 SizeMode property.

       rightButton = new LabelButton();
       rightButton.label = "Next";
       rightButton.size = 100;
     

The code listings above create the following buttons:

Opposite flow and size



Class information:
PlayBook Tablet OS Version:   1.0.6

See also

Container
Containment
SizeUnit



Public Constants

 ConstantDefined By
  BOTH : String = both
[static] A constant representing component sizing of the component in both the flow and opposite flow directions.
SizeMode
  FLOW : String = flow
[static] A constant representing component sizing only in the direction of the container's flow.
SizeMode

Constant Detail

BOTH


public static const BOTH:String = both

A constant representing component sizing of the component in both the flow and opposite flow directions.

FLOW


public static const FLOW:String = flow

A constant representing component sizing only in the direction of the container's flow.