Positioning, Alignment and Size of Gadgets
- Last UpdatedOct 29, 2024
- 2 minute read
AVEVA strongly recommend that you lay out your form using auto-placement in combination with relative placement because it allows gadgets to be added, removed, and repositioned without having to adjust the geometry of other gadgets on the form. In general, avoid the use of the AutoAlign keyword.
Auto-placement chooses a gadget's position coordinate automatically, relative to the last placed gadget.
Relative placement uses the AT syntax to specify a gadget's position coordinate relative to the limits of previously placed gadget.
A gadget's size component, width or height, is either a literal value, or a previous gadget's size component, or an extension to a previous gadget's co-ordinate limit, as in, min or max. The last option, referred to as sizing to Positional Extent, uses the width to... and height to... syntax. This makes it much simpler to lay out complex and resizable forms.
The following example form demonstrates layout of a simple, fixed size dialog form using the VarChars layout mode. Each gadget's position is set within the gadget definition either, implicitly using auto-placement, or using relative placement with the AT syntax. Gadget sizes are set implicitly, or relative to the size of other gadgets or to the positional extents of other gadgets.

Note:
No actual co-ordinate positions are required to specify this form. It is mostly undesirable
and unnecessary to specify a gadget's position as absolute grid co-ordinates, for
example, at x 12, y 5; AVEVA recommend defining the layout of each gadget relative
to a predecessor. This allows simple editing of the layout, without having to calculate
new positions. There are exceptions, for example, for the first gadget in a form or
frame, where you may want to establish an initial x or y co-ordinate that is not at
the default position.
Here is the corresponding PML code file: usingVarChars.pmlfrm. The layout keywords are explained later in the chapter, and have been emphasized for clarity.
|
layout form !!usingVarChars dialog $*--setup form !!usingVarChars dialog Varchars NoAlign title |Form !!usingVarChars| path down paragraph .para1 text 'Simple form layout using VarChars' frame .frame1 |frame1: See my gadgets| paragraph .para2 text 'text positioned implicitly in frame1' frame .frame2 |frame2: path right| toggle .tog1 |BBC news 24| path right toggle .tog2 |BBC 1| toggle .tog3 |BBC 2| path down vdist 0 frame .frame3 |frame3: path down, vdist 0| at xmin.frame2 width to max.frame2 -- path down, vdist 0 gives minimum vertical spacing rtoggle .rad1 |ClassicFM| at xcen.frame3 - 0.5 * size rtoggle .rad2 |Caroline| rtoggle .rad3 |BBC Radio 2| exit exit exit button .cancel |CANCEL| at xmin form CANCEL path right button .ok |OK| at xmax form-size OK exit |