Web searches for simple concepts like making all control captions the same width, making a control caption the same height as its control, making buttons share the same size, and making a set of buttons centred in the window find little or nothing of use.
Example code:
Code: Select all
goBackBy := 0
Gui, Add, Text, , Go back by:
Gui, Add, Edit, vGoBackBy Number Right Limit4 ym
Gui, Add, Button, Default, OK
Gui, Add, Button, Cancel x+m, Cancel
Gui, Show, Center, Go back
It seems illogical to me to have to specify all the captions first, and then all the controls later, as captions and controls are not paired in the code. However, putting all the captions first, then using ym to start a new column, seems to be the only way to make the controls go in a column beside the captions.
Then we have the caption ("Go back by") vertically offset relative to its control. Since the GUI has no idea which captions belong with which controls, it couldn't make them align properly if it wanted. Also, if the control heights vary (e.g. a listbox or multi-line text box is taller than an edit field), column-based layout will be impossible.
The idea of using the size from the previous control only works if the previous control was larger. You need a TARDIS to make the OK button the same width as Cancel, as at the time that OK is being added, the size of Cancel isn't know. In fact, depending on language, either one could be larger.
Has anyone here ever programmed in OPL for an EPOC32 Psion? (Series 5/5mx/Revo etc) Psion figured that most dialog boxes can be achieved by placing all the controls one above another, each one with a caption to its left. Buttons could be placed in a row across the bottom, or in a column down the right. Instead of having controls in a grid, if you needed more space, instead of starting a new column on the right, you'd start a new tab with the dialog (although OPL didn't offer this!)
The EIKON GUI – dialogs (sadly no code examples)
Is there any means in AutoHotkey (or through a library) to achieve basic dialog layout, i.e. just add a series of controls, that stack vertically, with correctly-aligned captions on the left (and captions visibly associated in the code with their related controls), optionally some form of panel selector (icons down the left, or tabs), and with one or more buttons of equal size at the bottom centre or top right, that is completely free of any hack that would break support for DPI, localisation or typeface and font size?