Positioning, Alignment and Size of Gadgets
- Last UpdatedNov 12, 2025
- 2 minute read
We strongly recommend that you lay out your form using auto-placement in combination with relative placement and use the NoAlign keyword.
Note: This is vital because it allows gadgets to be added, removed, and repositioned, without having to adjust the geometry of all the other gadgets on the form.
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 a previously placed gadget.
NoAlign switches off the default approximate centre-alignment of the gadgets TEXT, OPTION, COMBO, TOGGLE and single line PARAGRAPH for path right and path left, which interferes with Auto-placement.
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, that means, 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 the AT syntax. Gadget sizes are set implicitly, or relative to the size of other gadgets or to the positional extents of other gadgets.

Figure 17:3. Form definition using the VarChars layout mode
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; we 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 for the form: usingVarChars.pmlfrm. The 'layout' keywords are emboldened and explained later in the chapter.
|
setup form !!usingVarChars dialog Varchars NoAlign $*-- layout form !!usingVarChars dialog 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 |