Function Reference


_GUICtrlListView_FindInText

Searches for an item that contains the specified text anywhere in its text

#include <GuiListView.au3>
_GUICtrlListView_FindInText ( $hWnd, $sText [, $iStart = -1 [, $bWrapOK = True [, $bReverse = False]]] )

Parameters

$hWnd Control ID/Handle to the control
$sText Text to match
$iStart [optional] 0-based index of the item to begin the search with or -1 to start from the beginning.
The specified item is itself excluded from the search.
$bWrapOK [optional] If True, the search will continue with the first item if no match is found
$bReverse [optional] If True, the search will start at $iStart - 1 to Zero. If $bWrapOK = True search will continue

Return Value

Success: the 0-based index of the item.
Failure: -1.

Remarks

The search is case insensitive. Unlike _GUICtrlListView_FindText(), this function will search all subitems for the text as well.

Related

_GUICtrlListView_FindText

Example

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        GUICreate("ListView Find In Text (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; Set ANSI format
;~     _GUICtrlListView_SetUnicodeFormat($idListview, False)

        ; Add columns
        _GUICtrlListView_InsertColumn($idListview, 0, "Items", 100)

        ; Add items
        _GUICtrlListView_BeginUpdate($idListview)
        Local $iI
        For $iI = 1 To 49
                _GUICtrlListView_AddItem($idListview, "Item " & $iI)
        Next
        _GUICtrlListView_AddItem($idListview, "Target item")
        For $iI = 51 To 100
                _GUICtrlListView_AddItem($idListview, "Item " & $iI)
        Next
        _GUICtrlListView_EndUpdate($idListview)

        ; Search for target item
        $iI = _GUICtrlListView_FindInText($idListview, "tArGeT")
        MsgBox($MB_SYSTEMMODAL, "Information", "Target Item Index: " & $iI)
        _GUICtrlListView_EnsureVisible($idListview, $iI)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example