Page 1 of 1

Position another gui below the button

Posted: 23 Jun 2019, 13:15
by m3user
Sorry, I struggle with this... I try to show another gui exactly below the button but whatever I do the position is not correct... What am I doing wrong? I need it to work on both, normal and 4K monitors.

Code: Select all

DPf:=A_ScreenDPI/96
gui, add, button, w80 h30 vMyButton gOpen, Button
gui, show, w200 h200
return

Open:
WinGetPos, x, y,,, A
GuiControlGet, Pos, Pos, MyButton
Xpos:=PosX + x
Ypos:=PosY + PosH + y
gui, 2:-caption
gui, 2:margin, 0, 0
gui, 2:add, edit, w100 h100
gui, 2:show, x%Xpos% y%Ypos% w100 h100
return

Re: Position another gui below the button

Posted: 23 Jun 2019, 13:28
by Hellbent
You need to add the height of the windows border

***Edit***
This is what I get from the window spy.

Code: Select all

x: 580	y: 254	w: 206	h: 229
Client:		w: 200	h: 200

Re: Position another gui below the button

Posted: 23 Jun 2019, 14:25
by m3user
How can I get this?

Re: Position another gui below the button

Posted: 23 Jun 2019, 14:49
by Hellbent
m3user wrote:
23 Jun 2019, 14:25
How can I get this?
It comes with AHK. Run any script and go to the "Show hidden Icons" thing at the bottom of your screen, right click your script and select window spy.

But you don't need that, just play around with adding the approximate thickness of the windows top border to your

Code: Select all

Ypos:=PosY + PosH + y + 26
There might be a better way to get the thickness, but I don't know what it is and don't really care enough to look it up.