Class LayoutManager() Foundation
Class function of the LayoutManager class
The LayoutManager class contains functionality to preserve the arrangement of the UI elements (layout) contained in a form when the form is resized.
The class implements the default layout manager which is used by the system. Forms which use a LayoutManager instance automatically support placing elements relative to borders of their container elements ("anchoring").
Unless otherwise specified, the system automatically instantiates a LayoutManager object whenever a numeric value is assigned to the :layoutAlign instance variable of an Xbase Part. This default behaviour can be overriden by assigning the class object of another class to an Xbase Part's :LayoutManager instance variable. In this case, an instance of the class specified in :layoutManager will be created instead.
Whenever an Xbase Part is added as a child of a form or another container, the value in the child's :layoutAlign instance variable is used to determine the desired location and dimensions of the child with respect to its container. The value which can be assigned to the instance variable depends on the layout manager object used by the container. The default LayoutManager class recognizes the following numeric values which are defined as constants in the file xbp.ch.
Constant | Description (effect on the child) |
---|---|
XBPLAYOUT_NONE | Position/dimensions not changed. |
XBPLAYOUT_LEFT | Left border position is an absolute offset from container's left edge. |
XBPLAYOUT_TOP | Top border position is an absolute offset from container's top edge. |
XBPLAYOUT_RIGHT | Right border position is an absolute offset from container's right edge. |
XBPLAYOUT_BOTTOM | Bottom border position is an absolute offset from container's bottom edge. |
XBPLAYOUT_RELLEFT | Offset from container's left edge is relative, not absolute. |
XBPLAYOUT_RELBOTTOM | Offset from container's bottom edge is relative, not absolute. |
XBPLAYOUT_RELRIGHT | Offset from container's right edge is relative, not absolute. |
XBPLAYOUT_RELTOP | Offset from container's top edge is relative, not absolute. |
XBPLAYOUT_CENTERX | Horizontal position is computed based on the center points of the child and the container. This option is typically used to keep objects centered horizontally within their container. |
XBPLAYOUT_CENTERY | Vertical position is computed based on the center points of the child and the container. This option is typically used to keep objects centered vertically within their container. |
XBPLAYOUT_RELWIDTH | The object's width is relative to the width of the container. If XBPLAYOUT_CENTERX is not specified, the left border position is an absolute offset from container's left edge. |
XBPLAYOUT_RELHEIGHT | The object's height is relative to the height of the container. If XBPLAYOUT_CENTERY is not specified, the bottom border position is an absolute offset from container's bottom edge. |
The position and dimensions of a child can be relative or absolute in relation to its container. Unless one of the XBP_RELxxx contants is added to the value in the child's :layoutAlign instance variable, the position and/or dimensions are absolute. This means that the child always maintains a certain distance to the edge or edges of the container it is anchored to. If relative positioning is used instead, the distance is computed as a fraction of the container size. The same is true for the object dimensions if the XBP_RELWIDTH or XBP_RELHEIGHT constants are used.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.