Is it unnecessary to declare a reference to a control variable in a function? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

Is it unnecessary to declare a reference to a control variable in a function?

17 Apr 2019, 09:39

Hello,
Is it unnecessary to declare a reference to a control variable in a function?
I found that it works fine even if the control variable is not declared in the function.

Code: Select all

Gui, Add, Text, w50 vtext
Gui, Show, h100 w200
f()
return

f()
{
    ; Global text
    guicontrol,, text, xxxxxxxx
    return
}
Albireo
Posts: 1756
Joined: 16 Oct 2013, 13:53

Re: Is it unnecessary to declare a reference to a control variable in a function?

17 Apr 2019, 10:49

You do not need to declare any variable.
The only variable that may need to be declared is whether you are creating an array or an object
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Is it unnecessary to declare a reference to a control variable in a function?  Topic is solved

17 Apr 2019, 10:59

ControlID in GuiControl, SubCommand, ControlID [, Value] accepts a string or a hwnd. it has nothing to do with variables.

when u do guicontrol,, text, xxxxxxxx ure passing literal strings to ControlID, its the same as doing the expression equivalent guicontrol,, % "text", xxxxxxxx

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder, tabr3 and 116 guests