Pushing a button that refreshes the text in the GUI

Ask gaming related questions (AHK v1.1 and older)
User avatar
RealThingerthing
Posts: 13
Joined: 07 Sep 2022, 01:01

Pushing a button that refreshes the text in the GUI

Post by RealThingerthing » 31 Jan 2023, 12:55

Code: Select all

Iterations := 0 ; - amount of times it inputs
Gui EC: New, -Resize
Gui Font,, FixedSys
Gui Add, Text, hWndhTxtAutoclon x67 y0 w66 h20, Extraclick
Gui Font,, FixedSys
Gui Add, Button, x176 y25 w25 h25 gadd1, +1
Gui Add, Button, x-1 y25 w25 h25 gsub1, -1
Gui Add, CheckBox, x40 y30 w20 h15
Gui Add, Text, hWndhExtrainput x60 y28 w100 h19 +0x200, %Iterations%

Return
add1:
    ++Iterations
    GuiControl,, hWndhExtrainput, %Iterations%   
    Return
sub1:
    --Iterations
    GuiControl,, hWndhExtrainput, %Iterations%
    Return
ECGuiEscape:
ECGuiClose:
    ExitApp
I'm trying to create a easier way to use my program which will do extra clicks that can be increased with these buttons which works, however it doesn't refresh the text that shows what value the iterations variable is.
I've tried using the 3 ways (i know of) of finding the text and replacing it but none of them work. Setting the text to some random text also doesn't work either, does anyone know what i'm doing wrong?

User avatar
DuckingQuack
Posts: 219
Joined: 20 Jan 2023, 18:20

Re: Pushing a button that refreshes the text in the GUI

Post by DuckingQuack » 31 Jan 2023, 15:34

This might be related to your problem:
V: Variable. Associates a variable with a control. 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). For example, specifying vMyEdit would store the control's contents in the variable MyEdit whenever the Gui Submit command is used. If a control is not input-capable -- such as a Text control or GroupBox -- associating a variable with it can still be helpful since that variable's name serves as the control's unique identifier for use with the ControlID parameter of GuiControl and GuiControlGet, and with A_GuiControl.
https://www.autohotkey.com/docs/v1/lib/Gui.htm#Events
Best of Luck,
The Duck

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Pushing a button that refreshes the text in the GUI

Post by mikeyww » 04 Feb 2023, 08:15

Or:

Code: Select all

GuiControl,, % hExtrainput, % Iterations

Post Reply

Return to “Gaming Help (v1)”