[previous] [up] [next]     [contents] [index]
Next: Frames and Dialogs Up: Geometry Management Toolbox Previous: Child Classes

Panels

The geometry management toolbox provides several types of container panels:

The latter three classes are derived from mred:panel%. Each of these panels place their children slightly differently, but all have a certain core functionality.

A mred:panel% can function as a child inside another panel and therefore has all the properties and behaviors of the children noted in the previous section. In addition, the panels provide several methods for managing their children. The add-child function adds a child to the end of the children list, and the delete-child removes a child from the list. The change-children offers complete control over the list of children by accepting a function which can perform any non-destructive operation on the list of children. The place-children method gives the panels the ability to move and resize their children as determined by the panel's size, and the redraw method actually draws the children at the locations calculated by place-children.

The mred:panel% class simply forces all of its children to their minimum size and places them all at their default positions. Since these positions are not re-calculated at run-time, it is possible for controls to overlap. Therefore, the use of this panel is not recommended except as a base class for more intelligent panels.

The mred:horizontal-panel% class arranges all of its children in a single, left-justified, horizontal row. The children are displayed in the same order in which they occur in the panel's list of children. The children are stretched to fill the entire height of the panel (less a small border), or centered vertically if they are not vertically stretchable. Any extra space left over after the children are placed is divided evenly between all horizontally stretchable children. (Note that this may not have the desired effect; if two controls with minimum widths 40 and 10 are placed into a panel of width 200, border 10, and spacing 10, they will be given widths of 115 and 85, respectively.) The placement of the panel's children is recomputed at run-time, both when the panel is resized (typically as a result of the window being resized) and when a child forces a redraw. The border and spacing methods allow the inspection and mutation of the size of the border around the edge of the panel and the size of the spacing between the panel's children, respectively.

The mred:vertical-panel% class provides the same functionality as the mred:horizontal-panel%, but its children are arranged in a single vertical column, top-justified. The children are centered horizontally and stretched to fill the entire width of the panel when possible.

The mred:single-panel% class can have several children, but only displays one of them at a time. The width of this panel is the width of the widest child, and the height of this panel is the height of the tallest child. The currently-displayed child can be inspected and set by using the active-child function. Since this panel only displays a single child, the inter-object spacing is meaningless, but the border method is defined as with mred:horizontal-panel% and mred:vertical-panel%.


[previous] [up] [next]     [contents] [index]
Next: Frames and Dialogs Up: Geometry Management Toolbox Previous: Child Classes

PLT