Searches for an item with the specified characteristics
#include <GuiListView.au3>
_GUICtrlListView_FindItem ( $hWnd, $iStart, ByRef $tFindInfo [, $sText = ""] )
$hWnd | Control ID/Handle to the control |
$iStart | 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. |
$tFindInfo | $tagLVFINDINFO structure that contains the search information. |
$sText | [optional] String to compare with the item text. It is valid if $LVFI_STRING or $LVFI_PARTIAL is set in the Flags member. |
Success: | the 0-based index of the item. |
Failure: | -1. |
$tagLVFINDINFO, _GUICtrlListView_FindNearest, _GUICtrlListView_FindParam
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
GUICreate("ListView Find Item (v" & @AutoItVersion & ")", 400, 300)
Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState(@SW_SHOW)
; Set ANSI format
;~ _GUICtrlListView_SetUnicodeFormat($idListview, False)
; Add columns
_GUICtrlListView_AddColumn($idListview, "Items", 100)
; Add items
_GUICtrlListView_BeginUpdate($idListview)
Local $iI
For $iI = 1 To 100
_GUICtrlListView_AddItem($idListview, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($idListview)
; Set item 50 parameter value
_GUICtrlListView_SetItemParam($idListview, 49, 1234)
; Search for target item
Local $tInfo = DllStructCreate($tagLVFINDINFO)
DllStructSetData($tInfo, "Flags", $LVFI_PARAM)
DllStructSetData($tInfo, "Param", 1234)
$iI = _GUICtrlListView_FindItem($idListview, -1, $tInfo)
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