Next Previous Up Top Contents Index

7.3 DUIM-Layouts Module

<row-layout>

Open abstract instantiable class

Summary

The class of row layouts.

Superclasses

<layout>

Init-keywords

border:
An instance of type <integer>. Default value: 0.

x-spacing:, spacing:

An instance of type <integer>. Default value: 0.

equalize-heights?:

An instance of type <boolean>. Default value: #f.

equalize-widths?:

An instance of type <boolean>. Default value: #f.

y-alignment:
An instance of type one-of(#"top", #"bottom", #"center"). Default value: #"top".

x-ratios:, ratios:

An instance of type false-or(<sequence>). Default value: #f.

Library

duim-layouts

Module

duim-layouts

Description

The class of row layouts. A row layout arranges its children in a row, automatically calculating the size and placement of each child within the specified parameters.

Figure 7.4 Three buttons arranged in a row layout

The border: init-keyword provides a border of whitespace around the children in the layout, and the value of this init-keyword represents the size of the border in pixels. This basically has the same effect as using the macro with-spacing around the layout, except it uses a simpler syntax.

The spacing: or x-spacing: init-keywords let you specify how much horizontal space, in pixels, should be inserted between the children of the layout. These two init-keywords can be used interchangeably.

If true, equalize-heights?: ensures that all the children of the layout have the same height.

If true, equalize-widths?: ensures that all the children of the layout have the same width.

By default, all the children of a row layout are aligned at the top. You can specify that they should be aligned at the bottom, or in the center, using the y-alignment: keyword.

The ratios: or x-ratios: init-keywords let you specify the proportion of the total layout that should be taken up by each individual child. These two init-keywords can be used interchangeably.

The value passed to ratios: needs to be a sequence of as many integers as there are children in the layout. Each child is then allocated the appropriate portion of horizontal space in the layout. For example, if the value #(1, 2, 3) is specified for the ratios: init-keyword of a row layout containing three children, then the first child would claim a sixth of the available horizontal space, the second child would claim a third of the horizontal space, and the third child would claim half the horizontal space, as shown in the diagram below.

Operations

None.

Example

To make a row of buttons that are all the same size:

contain(make(<row-layout>, 
             equalize-widths?: #t,
             children: buttons))

See also

<column-layout>, page 456

horizontally, page 467

<layout>, page 468

<grid-layout>, page 466

<stack-layout>, page 491

<table-layout>, page 494


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index