ControlGetPos does not retrieve X or Y (possible cause for Issue #88?)
Issue #90
closed
Working AHK:
MyGui := Gui(, "Get Positions")
Btn1 := MyGui.Add("Button", "x10 y10", "X = 10 Y = 10")
Btn2 := MyGui.Add("Button", "x10 y50", "X = 10 Y = 50")
Btn3 := MyGui.Add("Button", "x10 y90 h40", "X = 10 Y = 90")
BtnShow := MyGui.Add("Button", "x10 y130", "Get positions")
BtnShow.OnEvent("Click", GetPos)
MyGui.Show()
GetPos(*) {
ControlGetPos(&X1, &Y1, &Width1, &Height1, Btn1, "Get Positions")
ControlGetPos(&X2, &Y2, &Width2, &Height2, Btn2, "Get Positions")
ControlGetPos(&X3, &Y3, &Width3, &Height3, Btn3, "Get Positions")
MsgBox("Btn1: X=" X1 " Y=" Y1 " Width=" Width1 " Height=" Height1 "`nBtn2: X=" X2 " Y=" Y2 " Width=" Width2 " Height=" Height2 "`nBtn3: X=" X3 " Y=" Y3 " Width=" Width3 " Height=" Height3, "Positions")
}
Keysharp test (X and Y report as 0, Width and Height correctly reported).
MyGui := Gui(, "Get Positions")
Btn1 := MyGui.Add("Button", "x10 y10", "X = 10 Y = 10")
Btn2 := MyGui.Add("Button", "x10 y50", "X = 10 Y = 50")
Btn3 := MyGui.Add("Button", "x10 y90 h40", "X = 10 Y = 90")
BtnShow := MyGui.Add("Button", "x10 y130", "Get positions")
BtnShow.OnEvent("Click", "GetPos")
MyGui.Show()
GetPos() {
pos1 := ControlGetPos("X = 10 Y = 10", "Get Positions")
pos2 := ControlGetPos("X = 10 Y = 50", "Get Positions")
pos3 := ControlGetPos("X = 10 Y = 90", "Get Positions")
MsgBox("X: " pos3["X"] " Y: " pos3["Y"] " Width: " pos3["Width"] " Height: " pos3["Height"])
}
Comments (4)
-
repo owner -
reporter Resolved, thank you! Closing.
-
reporter - changed status to resolved
Resolved
-
reporter - changed status to closed
closed
- Log in to comment
I’ve committed a fix, please test.