Please enable JavaScript to view this site.

ASQL Reference

Navigation: » No topics above this level «

Dialog Positioning

Scroll Prev Top Next More

The size of a dialog is based on interpreting the specified scol, srow, ecol and erow coordinates according to one of following grid systems:

Main window grid: If the dialog is a child of the main A-Shell window and neither the MBF_ALTPOS nor MBF2_PIXSIZE options are specified (and the Settings > Dialog Sizing > Dialog Grid Units option is not set to "Main window grid size"), then the dialog coordinates will be interpreted using the grid of the main window. For example, if the main window is divided into 24 rows and 80 columns, and the dialog coordinates are 12, 40, 26, 90, then the dialog will be positioned with the upper left corner roughly in the position of the main windows' row 12, column 40, and will extend approximately two rows and ten columns beyond the bottom and right edge of the main window. (The positions are somewhat approximate due to some internal margins in both the dialog and main window, the thickness of the dialog border, etc.) Note that these main window grid units are calculated dynamically based on the size of the main window at the time the dialog is created, which raises the risk of the resulting dialog being too big or too small.
Altpos grid: If the MBF_ALTPOS flag is specified (or the Settings > Dialog Sizing > Dialog Grid option is set to "Windows desktop font size"), then the "altpos" (alternate positioning) grid is used. The units of this grid are based on the resolution and size of the Windows desktop font, about 120% of that font's character height and average character width. This grid system makes it easy to lay out controls in standard rows and columns that adjust automatically to the desktop resolution, which is the way most Windows dialogs work.
Pixels: If you specify the MBF2_PIXSIZE or MBF2_PIXCOORDS flags, then you can specify the height and width (or all the coordinates, if MBF2_PIXCOORDS) in pixels.

Although the Altpos grid system is the most convenient of the three, in all cases you can use the AUI_WINDOW function to query the details of the grid system and monitor configuration in order to size and position the dialog relative to the available space.

You can also center the dialog, using the cstate flags MBST_HCENTER and MBST_VCENTER (in which case you might was well set the left and top coordinates of the 1,1 and the right and bottom to the desired width and height).

See the sample programs DLGCTR, DLGCTR2 and DLGCTR3 in EXLIB:[908,28] for various examples of these techniques.

History

2012 November:  This topic added.