Position another gui below the button

Get help with using AutoHotkey and its commands and hotkeys
m3user
Posts: 147
Joined: 17 Jan 2014, 18:11

Position another gui below the button

23 Jun 2019, 13:15

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
Hellbent
Posts: 740
Joined: 23 Sep 2017, 13:34

Re: Position another gui below the button

23 Jun 2019, 13:28

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
Hellbent
Posts: 740
Joined: 23 Sep 2017, 13:34

Re: Position another gui below the button

23 Jun 2019, 14:49

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.

Return to “Ask For Help”

Who is online

Users browsing this forum: abitofmaya, Google [Bot], JerryTheGnome and 112 guests