Function Reference

_GUICtrlListGetText

Returns the item (string) at the specified index

#Include <GuiList.au3>
_GUICtrlListGetText($h_listbox, $i_index)

 

Parameters

$h_listbox control id/control hWnd
$i_index Specifies the zero-based index of the string to retrieve

 

Return Value

The return value is the item string
If $i_index does not specify a valid index, the return value is $LB_ERR.

 

Remarks

None.

 

Related

_GUICtrlListGetSelItemsText, _GUICtrlListGetTextLen

 

Example


#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $label

GUICreate("ListBox Get Text Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$label = GUICtrlCreateLabel("Item #", 150, 210, 120)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $listbox
            $ret = _GUICtrlListGetText ($listbox, _GUICtrlListSelectedIndex ($listbox))
            If ($ret == $LB_ERR) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText")
            Else
                GUICtrlSetData($label, "Item : " & $ret)
            EndIf
    EndSelect
WEnd