cannot display a value in a edit control

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
takayo97
Posts: 63
Joined: 09 Jun 2018, 16:30

cannot display a value in a edit control

10 Aug 2018, 22:51

here are some snippet of my code

Code: Select all

#SingleInstance Force

Ping = 200

ShowControlBox()
{
    gui 2:+AlwaysOnTop +ToolWindow -MinimizeBox  -MaximizeBox
    gui 2:Add, Text, x+10 y5, In-game Ping:
    gui 2:Add, Edit, vPing gPing x+5 y1 w50, %Ping%
    gui 2:Show, x858 y0 w300 h23, Control Box

}

ShowControlBox()

Ping:
;will do something here when the edit control is updated
return

an error was throw when executed the script
Error: a control's variable must be global or static


The error is pointed at this line ----> gui 2:Add, Edit, vPing gPing x+5 y1 w50, %Ping%
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: cannot display a value in a edit control

10 Aug 2018, 23:11

Try this

Code: Select all

#SingleInstance Force
global Ping
Ping = 200

ShowControlBox()
{
    gui 2:+AlwaysOnTop +ToolWindow -MinimizeBox  -MaximizeBox
    gui 2:Add, Text, x+10 y5, In-game Ping:
    gui 2:Add, Edit, vPing gPing x+5 y1 w50, %Ping%
    gui 2:Show, x858 y0 w300 h23, Control Box

}

ShowControlBox()

Ping:
;will do something here when the edit control is updated
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 347 guests