Common Desktop Environment: Application Builder User's Guide

Attaching Objects

Attachments (and groups, which are based on attachments) establish dynamic layout behavior for objects in the interface. Dynamic layout behavior ensures that objects will maintain consistent relationships during resize activities. Attachments enable an internationalized application to work well in a number of locales.

All child objects are attached by their top and left edges to the top and left edge of their parent object, by default. Thus a control pane dropped on a main window is attached by its left and top edges to the left and top edges of the main window. Similarly, a button dropped on the control pane is attached to the control pane.

If the parent object is resized in an upward or leftward direction, the child object moves with the parent, maintaining the distance from the top and left edge of the parent.

If a pane object is dropped on the top or left edge of its parent it will be attached to that edge with an offset of 0. If it is dropped some distance to the right and below the left and top edges of its parent, it will have positive offsets.

If a pane object is resized from its right and bottom edges so that it spans its parent object, it will be attached to the right and bottom edges of its parent.

Attachments Editor

Used to attach objects to each other for layout purposes, the Attachments Editor is described below.

Graphic
Object Type

An option menu for choosing the type of object for which you want to make attachments. Some object types (custom dialog, file selection dialog, main window) do not have parents and are not included in the menu.

Objects

A scrolling list for selecting the object for which you want to make attachments.

Parent

A text field that indicates the parent of the selected object.

Children

A scrolling list that lists the children of the Parent object.

Parent attachments/Attachments in child

Radio buttons for displaying the attachments of the parent of the selected object or the attachments of the children of the selected object.

Some objects (draw area pane, term pane, text pane) cannot have children and may be children of a main window or custom dialog; thus, neither Parent attachments nor Attachments in child will be active. If the pane is a child of another pane, though, or if it is part of a layered pane, Parent attachments will be active.

Attach To

Option menus for choosing the type of attachment for the selected object and what to attach the object to. Also includes text fields for specifying the Offset (in pixels) from the selected object and its parent or sibling (a sibling is another object with the same parent) or for specifying the Percentage offset of the selected object from its parent.

The option menu below "Attach To:" is for choosing which sibling to attach to and is active only for sibling attachments (two small squares). The Offset text field is active for absolute (pixel) attachments only; the Percentage text field is active for percentage attachments only.

The selected object is shown in the center of its four possible attachments. The attachments, starting at the top and going clockwise, are top edge of selected object, right edge of selected object, bottom edge of selected object, and left edge of selected object.

Top- and left-edge attachments are illustrated and described below; by default an object is attached at its top and left edges to the top and left edges of its parent. The selected object (the object at the center of the four Attach To boxes) is the controlling object: if you move this controlling object, the pixel or percentage offset is changed; click Reset to see current values after moving an attached object.

If an attached parent object is resized, its child objects will retain their pixel or percentage offsets from the edges of their parent. The offsets will change if a child object is moved.

Sibling icons (two small squares) are inactive if the selected object has no siblings.

An ascending line from the top edge of a small square to the top edge of its surrounding box represents an absolute (pixel offset) attachment of the top edge of the selected object to the top edge of its parent.

A descending line from the top edge of a small square to the bottom edge of its surrounding box represents an absolute (pixel offset) attachment of the top edge of the selected object to the bottom edge of its parent. This value will be negative, since y values are positive as they ascend and negative as they descend.

Two vertically-aligned squares connected by a vertical line represent an absolute (pixel offset) attachment of the top edge of the selected object to the bottom edge of its sibling. The offset will change if the selected object is moved. This value will be negative if the top edge of the selected object is above the bottom edge of its sibling.

Two horizontally-aligned squares connected by a horizontal line to the centers of their top edges represent an absolute (pixel offset) attachment of the vertical center of the selected object to the vertical center of its sibling. The offset will change if the selected object is moved. This value will be negative if the center of the selected object is above the center of its sibling.

A square with a two-headed arrow and a percentage sign above it represents a percentage offset attachment of the top edge of the selected object to the top edge of its parent. The offset will change if the selected object is moved.

A square with a percentage sign above it and a two-headed arrow between the center line of the square and the top of the surrounding box represents a percentage offset attachment of the center of the selected object to the top edge of its parent. The offset will change if the selected object is moved.

A circle with a diagonal line through it represents no attachment from the edge (top, left, bottom, or right) to another object. By default a dropped object has no right or bottom edge attachments.


Note -

Descriptions of the attachments to the bottom edge of the selected object are correlatives of the descriptions of the top-edge attachments above. Substitute "bottom" for "top" and "top" for "bottom" for bottom-edge attachments. Normally you will want top- and left-edge attachments only.


A horizontal line from the left edge of the surrounding box to the left edge of a small square represents an absolute (pixel offset) attachment of the left edge of the selected object to the left edge of its parent. The offset will change if the selected object is moved.

A horizontal line from the right edge of the surrounding box to the left edge of a small square represents an absolute (pixel offset) attachment of the left edge of the selected object to the right edge of its parent. The offset will change if the selected object is moved. This value will be negative, since x values are positive to the left and negative to the right.

Two horizontally-aligned squares connected by a horizontal line represent an absolute (pixel offset) attachment of the left edge of the selected object to the right edge of its sibling. The offset will change if the selected object is moved. This value will be negative if the left edge of the selected object is left of the right edge of its sibling.

Two vertically-aligned squares connected by a vertical line to the centers of their left edges represent an absolute (pixel offset) attachment of the horizontal center of the selected object to the horizontal center of its sibling. The offset will change if the selected object is moved. This icon is inactive if the selected object has no siblings. This value will be negative if the center of the selected object is left of the center of its sibling.

A square with a two-headed arrow and a percentage sign above it represents a percentage offset attachment of the left edge of the selected object to the left edge of its parent. The offset will change if the selected object is moved.

A square with a percentage sign to its left and a two-headed arrow between the center line of the square and the left of the surrounding box represents a percentage offset attachment of the center of the selected object to the left edge of its parent. The offset will change if the selected object is moved.


Note -

Descriptions of the attachments to the right edge of the selected object are correlatives of the descriptions of the left-edge attachments above. Substitute "right" for "left" and "left" for "right" for right-edge attachments. Normally you will want top- and left-edge attachments only.


To Attach Objects in an Interface

See "Attachments Editor" for an illustration of the editor and descriptions of its elements.

  1. Choose Attachments from the Editors menu in the App Builder primary window to display the Attachments Editor.

    The Attachments Editor can also be displayed by clicking the Attachments button in a property editor or by choosing Attachments from the interface or Module Browser pop-up menu.

  2. Choose the object type you want to attach to its parent or siblings.

  3. Select the object that you want to attach.

  4. Select an attachment type.

    If you choose an icon with one small square you are making an attachment from a child object to its parent. If you choose an icon with two small squares you are making a sibling attachment. See "Attachments Editor" for descriptions of the types of attachments.

    When you make an attachment, the selected object--the object in the center of the four Attach To boxes--is the controlling object. That is, this object can be moved without affecting its parent or sibling. The offset value or percentage value will change to reflect the changed relationship between the two objects.

    On the other hand, if you move the other object--the object to which the selected object is attached--the selected object will move so as to maintain its relationship with the other object.

    You may have to click Reset after moving an object in the interface before the change is noted in the Attachments Editor.

  5. Click OK or Apply to apply the changes.

    If you click OK, the Attachments Editor will be dismissed.