Position of Forms on the Screen
- Last UpdatedOct 25, 2022
- 1 minute read
Mostly forms are automatically positioned by the system according to their type and the way they are shown.
The origin of a form is its top left hand corner.
When a form is displayed as a child form then it is always positioned with respect to its parent.
For a form shown from a MENU, its origin is at the origin of the parent. If the form is displayed from a BUTTON or any other gadget, its origin is at the center of the gadget.
When a form is shown as a free form for the first time then its default position is at the top left-hand corner of the screen.
Note:
It is strongly recommended that you allow the system to position forms whenever possible.
You can force the screen position of free-standing forms using the following commands or methods:
show !!MyForm Free At xr 0.3 yr 0.5
show !!MyForm Free centered xr 0.5 yr 0.5
!!MyForm.show( 'At', 0.3, 0.5 )
!!MyForm.show( 'Cen', 0.5, 0.5 )
The At option puts the origin of the form at the specified position; alternatively the Cen option puts the center of the form at the given position. The co-ordinate values are fractions of the screen width or height respectively and are referred to as screen co-ordinates.
For example:
show !!MyForm free At xr 0.25 yr 0.1
This positions the origin of !!MyForm one quarter of the way across from the left edge of the screen, and one-tenth of the way down from the top.
!!MyForm.show( 'Cen', 0.5, 0.5 )
This centers !!MyForm at the middle of the screen.