[v1.1.37.01]Gui modifies content with GuiControl

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dbgba
Posts: 20
Joined: 02 Apr 2021, 22:11

[v1.1.37.01]Gui modifies content with GuiControl

29 Feb 2024, 05:48

When Edit has a string, the test1 button will work normally

Code: Select all

Gui Add, Text, , The test1 button does not take effect when the edit box is empty
Gui Add, Edit, x10 y24 Section vvtext
Gui Add, Button, ys gtest1, test1
Gui Add, Button, ys gtest2, test2
Gui Show
Return

test1:
Gui Submit, NoHide
GuiControl, , %vtext%, 12345
Return

test2:
GuiControl, , Edit1, 67890
Return
gregster
Posts: 9113
Joined: 30 Sep 2013, 06:48

Re: [v1.1.37.01]Gui modifies content with GuiControl

29 Feb 2024, 06:45

https://www.autohotkey.com/docs/v1/lib/GuiControl.htm#Parameters wrote:ControlID
If the target control has an associated variable, specify the variable's name as the ControlID
Preferably, you should use the name of the v-variable, not its contents/text (at least not if its contents are blank). Then it works either way -> remove the %s:

Code: Select all

GuiControl, , vtext, 12345
The reason why it works when the Edit control is not blank, is this:
GuiControl Docs - Parameters wrote:Otherwise, specify for ControlID either ClassNN (the classname and instance number of the control) or the control's text, both of which can be determined via Window Spy. When using text, the matching behavior is determined by SetTitleMatchMode.
But if there is no text (aka blank), this can't work; there will be no match.

PS: I will move your topic from 'Bug Reports' to 'Ask for Help (v1)'.
Last edited by gregster on 29 Feb 2024, 06:59, edited 1 time in total.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 335 guests