Tivoli Service Desk 6.0 Developer's Toolkit Interface Designer Guide
Geometry management is used in the Interface Designer and GUI library to automatically size and position controls in a form when the form is resized. You apply geometry management to a control by setting its attachments. For more information on attachments, see "Designing Controls."
An attachment appears as a line from a control side to a form side. Every control has two attachment lines by default. You can add an attachment to each side of a control by pressing the shift key when adding a control to a form.
An attachment is used to set the distance between the side of a control and the side of a form. For example, the left attachment for a control determines the distance from the left side of the control to the left side of the form.
There are two types of attachments:
Attachment types are discussed in more detail in the following sections.
A fixed attachment specifies a set distance between a control side and a form
side and does not change when the form is resized. When you add a control to a form, a
likeness of the control appears on the attachment editor, located below the control
palette. A fixed attachment is represented as a solid line from the control side to the
form side. The following figure shows a control with two fixed attachments.
A percentage attachment specifies a proportionate distance between a control
side and a form side that changes when the form is resized. When you add a control to a
form, a likeness of the control appears on the attachment editor, located below the
control palette. A percentage attachment is represented as a dashed line from the control
side to the form side. The following figure shows a control with two percentage
attachments.
Offsets apply only to percentage attachments and are used to alter the position of controls after their percentage attachments have been calculated. Offsets can be positive or negative in adjusting the position of controls.
Dialog coordinates determine the size and position of controls regardless of screen resolution. Dialog coordinates cause buttons, labels, and entry fields to automatically scale when displaying their contents. Also, you can use any font and your forms adjust proportionately.
When you choose fonts, remember that there are separate scale types for horizontal and vertical sizing. The horizontal scale is based on the width of a single character. The vertical scale is based on the height of the font. This means that a form appears much smaller with a 6-point font than a 12-point font. (Different fonts also have different width-to-height ratios.)
This section contains examples of different sets of attachments. Numbers next to attachment lines indicate the attachment size.
Note: If you want to see how attachments work, construct each example using the Interface Designer, and test the forms by resizing them.
You can use any type of control to test geometry management.
As this form is resized, controls 1- 4 remain in their respective corners, because each control has a fixed attachment to the two nearest form sides. The controls do not change size because only two of the control sides are attached to the form.
Control 5 functions differently because it has all four sides attached to the form. Each side of control 5 is set to a fixed distance from the form side, so the control changes size as the form is resized.
Controls 1-4 do not change size, but their distance from the form sides changes proportionally to the size of the form. Control 5 changes size proportionally as the form is resized.
Controls 1 and 2 have an equal share of the available width of the form. However, the space between the two controls expands and contracts as the form is resized. The size of the space between the controls is only 2% of the width of the form. The small space between controls makes the form appear awkward. Using offsets with percentage attachments creates more space between controls.
The distance between the two controls remains constant when the form is resized. Offset values are added after percentage sizes for the attachments are computed.
Note: Offsets should not be used with fixed attachments.
This form functions similarly to the previous example with two controls. Percentage attachments for controls with adjacent sides should add up to 100%. For example, control 1's right attachment is 67%, so control 2's left attachment is 33%. Similarly, control 2's right attachment is 33%, so control 3's left attachment must be 67%. Opposing percentage attachments equaling 100% often produce the best layout though the 100% sum is not required.
For fixed and percentage attachments, negative offsets are used for controls 2 and 3 to center them on the form. (It is assumed that the width of controls 2 and 3 is 40 dialog units.
For more attachment examples, see the forms in the resource file of the Interface Designer.
Tivoli Service Desk 6.0 Developer's Toolkit Interface Designer Guide