Positioning Relative to the Form Extremities
- Last UpdatedNov 12, 2025
- 1 minute read
You can also position a new gadget relative to the current size of the form, and the current size of the gadget.
For example, if you want to place an OK button at the extreme right-hand bottom corner of the form, you could use the commands:
button .OK AT XMAX FORM-SIZE YMAX FORM OK
XMAX FORM and YMAX FORM refer to the maximum X and Y coordinates for the entire form so far.
XMAX FORM - SIZE subtracts the current gadget’s size so that the form will not expand. The net result of the above command is to add the OK button so that in the X-direction it just finishes at the form’s current maximum extent without increasing the form width, and in the Y-direction the gadget’s origin is placed at the form’s current maximum depth and extends it to include the gadget’s height. The result is:

Figure 17:9. Positioning Relative to Form’s Extremities
Typical code to add CANCEL and OK gadgets to a form would be:
button .CANCEL at xmin form ymax form CANCEL
button .OK at xmax form - size OK