Documentation

Reference
qx:hbox (qx.ui.layout.HBox)

A horizontal box layout.

The horizontal box layout lays out widgets in a horizontal row, from left to right.

Features

  • Minimum and maximum dimensions
  • Priorized growing/shrinking (flex)
  • Margins (with horizontal collapsing)
  • Auto sizing (ignoring percent values)
  • Percent widths (not size hint relevant)
  • Alignment (Children property qx.ui.core.LayoutItem#alignX is ignored)
  • Horizontal spacing (collapsed with margins)
  • Reversed children layout (starting from last to first)
  • Vertical children stretching (respecting size hints)

Item Properties

  • flex (Integer): Indicates the flexibility of the item, which indicates how an item's container distributes remaining empty space among its children. Flexible elements grow and shrink to fit their given space. Elements with larger flex values will be made larger than elements with lower flex values, at the ratio determined by the two elements. The actual value is not relevant unless there are other flexible elements within the same container. Once the default sizes of elements in a box are calculated, the remaining space in the box is divided among the flexible elements, according to their flex ratios. Specifying a flex value of 0 has the same effect as leaving the flex attribute out entirely.
  • width (String): Defines a percent width for the item. The percent width, when specified, is used instead of the width defined by the size hint. The minimum and maximum width still takes care of the elements limitations. It has no influence on the layout's size hint. Percents are mainly useful for widgets which are sized by the outer hierarchy.

Example

Here is a little example of how to use the grid layout.

var layout = new qx.ui.layout.HBox();
layout.setSpacing(4); // apply spacing

var container = new qx.ui.container.Composite(layout);

container.add(new qx.ui.core.Widget());
container.add(new qx.ui.core.Widget());
container.add(new qx.ui.core.Widget());

External Documentation

Extended documentation and links to demos of this layout in the qooxdoo wiki.

Copyright Notes

Description of flex property by Mozilla licensed under the CC Attribution-Sharealike License.

LGPL, EPL © 2008 QxTransformer | Siarhei Barysiuk & Christian Boulanger.
Site design and illustrations by Siarhei Barysiuk. | Icons by Dry Icons.

qooxdoo