The last two of the options in Variables would apply to control creation within functions, no? How about:Immediately after the letter V, specify the name of a global variable (or a ByRef local that points to a global, or [in v1.0.46.01+] a static variable)
There is also a little gotcha with parameter precedence related:Immediately after the letter V, specify the name of a variable. If the variable is desired to be global, declare it so, and if the control is created within a function, an outside declaration must match the variable name. Additionally within functions, the options for the variable can extend to either a ByRef local that points to a declared global, or [in v1.0.46.01+] a static variable).
Code: Select all
;global testMe
; Makes no difference in the function
; if testMe is declared as a parameter!
Gui, Add, Checkbox, vtestMe gTest, Test
Gui, show
return
Test:
; Update testMe
Gui, Submit, Nohide
CheckTest(dummy)
CheckTest(testMe)
CheckTestGlobal()
Return
CheckTest(testMe)
{
msgbox % (testMe)? testMe: " testMe not the parameter!"
}
CheckTestGlobal()
{
msgbox % (testMe)? testMe: " testMe not declared global!"
}
GUIClose:
ExitApp