Grouping GUI controls together? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
arcylix
Posts: 54
Joined: 27 Sep 2022, 14:43

Grouping GUI controls together?

Post by arcylix » 31 May 2023, 15:03

Is there a way to create containers of information? For example, in my GUI I'm going to have upwards to 32 text fields of information. When the GUI resizes, I do not want to have to initiate a movement for all 32 text fields. I've searched for an answer but cannot find one, so I hope this is possible.

Barring that, what would be the easiest way to reposition all lines of text in a GUI as I resize it? Thank you.

User avatar
boiler
Posts: 17075
Joined: 21 Dec 2014, 02:44

Re: Grouping GUI controls together?  Topic is solved

Post by boiler » 31 May 2023, 16:39

By using the Section option for positioning GUI controls, as well as the associated XS and YS options, you can move all the controls of a section at once by moving the one with the Section designation. However, that is not dynamic (won't move all of them by just moving the control) -- it "moves" them by recreating the GUI with the new position of the main control, so you would need to re-build the GUI using a new value for the position of the section control.

arcylix
Posts: 54
Joined: 27 Sep 2022, 14:43

Re: Grouping GUI controls together?

Post by arcylix » 31 May 2023, 20:02

@boiler

Thanks. I'll play around with that. Given the robustness of AHK, I am surprised there isn't a "Container" control, like:

Code: Select all

MyGui := Gui()
StatsContainer := MyGui.Add("Container", "Stats")
StatsContainer.Add("Text", , "Some stats text.")
Maybe one day, though! Appreciate your guidance!

Post Reply

Return to “Ask for Help (v2)”