I have a list that fills a combo box. Instead of "GUICtrlRead($SomeRandomBox)" returning the value of the data in the box, I would like it to return the position in the list.
In that example, the below code would return '2' not "second".
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $msg
GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered
GUICtrlCreateCombo("", 10, 10) ; create first item
GUICtrlSetData(-1, "First|Second|Third", "Second") ; add other item snd set a new default
GUISetState()
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndFunc ;==>Example
I am trying to avoid:
If GUICtrlRead($SomeRandomBox) = "First" Then $Value = 1
If GUICtrlRead($SomeRandomBox) = "Second" Then $Value = 2
I am guessing there is an easier way, since the list will grow.