Wondering if someone can help me with understanding the rules about GuiControl properties. In v1, I am a big user of g labels and GuiControlGet, so I am trying to build similar functionality in v2.
For the code below, it works fine as is. But if I un-comment the OnEvent for the checkbox control, I get Error: This value of type "String" has no property named "value".
I would really like to understand why. Thanks for any advice.
Code: Select all
;#Requires AutoHotkey v2.0
MyGui := Gui()
MyGui.OnEvent("Close", MyGui_Close)
MyGui.SetFont("s12", "Consolas")
MyCheckbox := MyGui.Add("Checkbox","y+12", " MyCheckbox") ;.OnEvent("Click", GetCtrlValue) ;Error: This value of type "String" has no property named "value".
MyGui.Add("Button",, "Get Value").OnEvent("Click", GetCtrlValue)
MyGui.Show()
return
;End of Autoexec
GetCtrlValue(*) {
MsgBox("MyCheckBox value is " MyCheckbox.value)
}
MyGui_Close(*) {
ExitApp
}