Problem with GUI/Turn labels on and off with the same checkbox. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Chernobyl Invader
Posts: 1
Joined: 11 Apr 2021, 14:56

Problem with GUI/Turn labels on and off with the same checkbox.

Post by Chernobyl Invader » 11 Apr 2021, 15:21

Hello everyone!
I have trouble understanding how the GUI works.
I would like to understand how to make the same checkbox turn on and off an imagesearch label.
Imagesearch is always working, in some tests I was only able to turn label on with the checkbox, but I can't turn off the label with the same checkbox.

Code: Select all

Gui, Add, Text, x12 y9 w100 h20, gImageS1, ImageS1
Gui, Add, CheckBox, x12 y29 w100 h30 , On/Off ; 

Gui, Add, Text, x12 y69 w100 h30, gImageS2, ImageS2
Gui, Add, CheckBox, x12 y99 w100 h30 , On/Off ; 

Gui, Add, Text, x12 y139 w100 h30, gImageS3, ImageS3
Gui, Add, CheckBox, x12 y159 w100 h30 , On/Off ; 

Gui, Show, w436 h314, Testing
return
GuiClose:
ExitApp
User avatar
mikeyww
Posts: 27072
Joined: 09 Sep 2014, 18:38

Re: Problem with GUI/Turn labels on and off with the same checkbox.  Topic is solved

Post by mikeyww » 11 Apr 2021, 15:25

GuiControl can alter a control such as a checkbox.

You can also create a routine to do something when you change the box.

Code: Select all

Gui, Add, CheckBox, x12 y29 w100 h30 gImageS1 vs1, ImageS1
Start:
Gui, Show, w436 h314, Testing
Return

ImageS1:
Sleep, 200
Gui, Submit
MsgBox, % s1 ? "Marked" : "Unmarked"
Gosub, Start
Return

GuiClose:
ExitApp
Post Reply

Return to “Ask for Help (v1)”