Useful Form Layout Quick Checklist
- Last UpdatedFeb 08, 2023
- 2 minute read
The layout for complex dynamic forms can be difficult to get right, so the simpler the code the easier it is to adjust.
-
It is rarely necessary to set the form width and height explicitly.
-
Use VarChars - variable spaced text layout mode (current default is FixChars). This gives more accurate layout and where text is explicit for a gadget it should remove the need to use TagWidth (except where specific alignment of a set of gadgets is needed). Also avoids need to use 'width' for buttons, toggles.
-
Use of 'path down' with 'vdist 0,2' removes the need to keep using ‘at ymax + 0.2' etc
-
Use of 'path right' with 'hdist 1.0' removes the need to keep using 'at xmax + 1.0'
-
When using 'anchor' for a gadget the default setting is 'Top + Left' so no need to say anything if this is all you need.
-
Minimize the use of literal values for co-ordinate positions and lengths whenever possible - use relative layout, which makes it easier to adjust the form later, for example,
frame .page2 Panel anchor all at xmin.page1 width.page1
-
It is not usually necessary to set the frame width and height, except for specific alignment purposes
-
You can use the 'form - size' and ‘.gad - size’ constructs to right align gadgets in a dynamic frame, for example,
button .nextPage linklabel 'Next' anchor bottom + right at xmax form-size ymin
-
There are some instances with layout of docking dialogs that sometimes the calculated frame size is slightly smaller than actual, it is always useful to compare with a simple dialog (with and without 'resize' set).