ScrollBars can be enabled for a Gui using
Controls can be automatically repositioned and resized relative to the Gui size.
The first time the Gui is shown, the size of each control becomes the "default size"; controls are resized and repositioned only when the Gui becomes larger than the initial size and relate always to the initial size. This is to allow you to define a minimum usable size for each control.
Resizing and repositioning values can be an integer (2), float (0.5) or fraction (1/3), negative values are also supported.
When no value is given it defaults to 1, so ax equals ax1 and ax1/1 and ax1.0
Note: the order in which controls are created is important if you want to align to previously repositioned controls.
The following options are supported to resize and reposition controls automatically:
AX: Reposition control horizontally, for example ax1/3
AY: Reposition control vertically, for example ay0.5
AW: Resize control width, for example aw0.5
AH: Resize control height, for example ah0.5
AXP: Use previous control position horizontally.
AYP: Use previous control position vertically.
AXA: Auto-Position X. Control will be placed to the right of the previous control.
AYA: Auto-Position Y. Control will be placed below the previous control.
AWA: Auto-Width. Control will be scaled by the same amount as the last control that used AW.
AHA: Auto-Height. Control will be scaled by the same amount as the last control that used AH.
Resetting horizontal and vertical alignment
Resetting alignment is necessary to start a new section of controls which will not consider changed position of previous controls.
For example when you add controls in a row and start a new row you will need to reset horizontal value so the new row will not consider moved position of previous row which is used to align controls.
AXR and AWR: Reset horizontal repositioning.
AYR and AHR: Reset vertical repositioning.
Gui, Add, Gui, <control options>, <hwnd or name/number of existing Gui>
This adds an existing Gui, as if it were a GuiControl.
You can use the guicontrol options to apply autopositioning values to the child Gui.
You can either replace your AutoHotkey.exe with the one in the attached ZIP, or simply extract the ZIP and double-click AutoHotkey.exe to run AutoHotkey.ahk with the EXE in the same folder.
An AutoHotkeySC.bin is included if you wish to compile scripts using it.
The ZIP contains Unicode 32 bit files only.
The GitHub repo is here: https://github.com/evilC/AutoHotkey_L
ToDo / Planned Features / Wish list
[*]Finalize mouse wheel scrollbar support (Must Have).
The current code is just a placeholder. I have a solution in mind here - scroll the HWND under the mouse cursor. I seem to remember using this technique in an implementation written in AHK and IIRC it worked OK.
- Reduce flicker (Should Have)
Controls can flicker sometimes on resize - we will look into ways to reduce this.
[*]Child Gui support (Could Have - though can be quite easily done in AHK code).
Add auto-size / auto-positioning for child Guis (Guis parented to other Guis with
+Parent). Also, parents consider children's size with respect to scrollbars.
This would open up numerous exciting possibilities - eg:
Scrolling sub-sections (header, footer, with scrolling mid-section etc)
Better support for resizing groupboxes / tabs (The contents of the groupbox or tab could be positioned and sized relative to the tab)
- ListView etc column sizing (Might Have)
Some way to define how columns of a listview change width when it sizes would be a nice touch.
[*]Tab control with scrolling content (Might Have)
Some way to avoid having to parent a child Gui to a textbox in order to achieve a tab control with scrolling contents.