GuiControl, ChooseString Error

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
oldbrother
Posts: 273
Joined: 23 Oct 2013, 05:08

GuiControl, ChooseString Error

22 Jun 2017, 21:56

Test Code:

Code: Select all

Gui, Add, ListBox, x0 y0 w150 h200 vList,AAA1|AAA2|AAA3|BBB3|BBB2|BBB|CCC
GuiControl,ChooseString,List,BBB
Gui, Show, w150 h200, Test
return

GuiClose:
ExitApp
Instead of choosing "BBB", "BBB3" will be chosen. Why?
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: GuiControl, ChooseString Error

22 Jun 2017, 22:07

From help file:
GuiControl, ChooseString, ControlID, String: Sets the selection (choice) in a ListBox, DropDownList, ComboBox, or Tab control to be the entry whose leading part matches String
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: GuiControl, ChooseString Error

23 Jun 2017, 00:53

One option:

Code: Select all

Gui, Add, ListBox, x0 y0 w150 h200 hwndHWND vList, AAA1|AAA2|AAA3|BBB3|BBB2|BBB|CCC
Controlget, Row, FindString, BBB, , ahk_id %HWND% ; Docs: Sets OutputVar to the entry number of a ListBox or ComboBox that is an exact match for String.
GuiControl, Choose, List, %Row%
Gui, Show, w150 h200, Test
Return

GuiClose:
ExitApp
This should have been posted in "Ask For Help".
User avatar
oldbrother
Posts: 273
Joined: 23 Oct 2013, 05:08

Re: GuiControl, ChooseString Error

23 Jun 2017, 05:12

Thank you very much! Have a nice weekend.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, ShatterCoder and 140 guests