Managing UI Geometry: 2.7 Arranging Your Generic Objects: Using Custom Child Spacing

Up: GEOS SDK TechDocs | Up | Prev: 2.6 Using Monikers | Next: 2.8 Allowing Children to Wrap
HINT_CUSTOM_CHILD_SPACING, HINT_CUSTOM_CHILD_SPACING_IF_LIMITED_SPACE, HINT_MINIMIZE_CHILD_SPACING

Normally, spacing of children within a composite is left entirely up to the specific UI. You can customize spacing, however, by using the hint HINT_CUSTOM_CHILD_SPACING . This hint takes a single argument of type SpecSizeSpec , described below.

The SpecSizeSpec structure defines both the spacing between children and how the spacing is determined. It exists as a record with two fields: The first field is a constant of type SpecSizeTypes , used to interpret the second field. The second field is data based on the type specified in the first field.

The different types allowable in the first field are

SST_PIXELS
Data specified in pixels.
SST_PCT_OF_FIELD_WIDTH
Data specified as a percentage of screen width. The data value is a fraction that gets multiplied by the width of the screen. Predefined fraction values to use in the data field are named PCT_ xx , where the xx represents any multiple of five between zero and 100 inclusive. You can get better accuracy by using your own value if desired, however.
SST_PCT_OF_FIELD_HEIGHT
Data specified as a percentage of screen height. As above except uses screen height rather than width.
SST_AVG_CHAR_WIDTHS
Data specified as a number that gets multiplied by the average width of a character in the font being used. The data may be between zero and 1023 inclusive.
SST_WIDE_CHAR_WIDTHS
Data is specified as a number that gets multiplied by the maximum width of the widest character in the font being used. The data may be between zero and 1023 inclusive.
SST_LINES_OF_TEXT
Data is specified as a number of text lines. The number will be multiplied by the height of a line of text in the font being used.

Both fields of the record are defined by using the bitwise-or operator. If you had a composite that wanted to line all its children up exactly next to each other, for example, you would specify the hint as follows:

@object GenInteractionClass @MyComp = {
    GI_comp = @child1, @child2, @child3;
    HINT_CUSTOM_CHILD_SPACING = SST_PIXELS | 0;
}

HINT_CUSTOM_CHILD_SPACING_IF_LIMITED_SPACE also takes a SpecSizeSpec to suggest a custom amount of spacing, but only implements this custom spacing if the specific UI determines that the children are already too tightly arranged. This hint may or may not be helpful, as the specific UI often allocates a minimum amount of spacing independent of this hint.

HINT_MINIMIZE_CHILD_SPACING ensures that child spacing is kept to an absolute minimum, even if this means that object's edges will touch (in color systems) or even overlap (in black and white systems).


Up: GEOS SDK TechDocs | Up | Prev: 2.6 Using Monikers | Next: 2.8 Allowing Children to Wrap