Page 1 of 1

GroupBox & relative control positioning

Posted: 31 Dec 2016, 12:00
by just me
If I run the following code

Code: Select all

#NoEnv
Gui, Margin, 10, 10
Gui, Add, GroupBox, w400 r5, Group
Gui, Add, Text, xp+10 yp+20, Text 1
Gui, Add, Edit, xp y+2, Edit 1
Gui, Add, Text, xp, Text 2
Gui, Add, Edit, xp y+2, Edit 2
Gui, Show, , GroupBox
Return
GuiClose:
ExitApp
i get overlapping controls within the GroupBox. If you remove the xp from the options of the second Text control, everything is fine. I'm running AHK 1.1.24.02 U64 on Win 10 Pro (10.0.10240 x64).

Can somebody confirm the results?

Re: GroupBox & relative control positioning

Posted: 31 Dec 2016, 12:36
by wolf_II
confirmed with
Win10 Pro x64 v10.0.14393
AHK x64 v1.1.24.04

Edit: I confirm also with AHK v1.0.48.03 on a Virtual WinXP x32.
Maybe this can help to track down the cause?

Re: GroupBox & relative control positioning

Posted: 01 Jan 2017, 17:35
by just me
lexikos? (Happy new year!)

Re: GroupBox & relative control positioning

Posted: 01 Jan 2017, 18:07
by lexikos
What are you trying to do?

I get the same results without the GroupBox. I see nothing in the documentation about GroupBox affecting the positioning of other controls.

Re: GroupBox & relative control positioning

Posted: 01 Jan 2017, 23:39
by hunter99
Hi and Happy New Year,
Don't know if this will help. As I'm running Win7 Pro. and get the same results.
But if I add y+2 to second Text like so:
"Gui, Add, Text, xp y+2, Text 2"
The problem is gone.

hunter99

Edit:
Here is what I get with all 4 combinations.

just xp gives overlap between Edit1 and Text2
no xp or y+2 gives space between Edit1 and Text2
just y+2 gives no space between Edit1 and Text2
xp and y+2 gives no space between Edit1 and Text2

Re: GroupBox & relative control positioning  Topic is solved

Posted: 02 Jan 2017, 02:32
by jNizM
xp without y(p)+(n) use the same spot like the control before...
can be used to position controls relative to the previous control's upper left corner

Re: GroupBox & relative control positioning

Posted: 02 Jan 2017, 04:15
by just me
OK, my bad. RTFM is something you cannot do often enough! :?
The docs wrote:xp y+m positions a control below the previous control, whereas specifying an X coordinate on its own would normally imply yp by default.
Thanks to all contributors.