Searches for an item with the specified lParam
#include <GuiListView.au3>
_GUICtrlListView_FindParam ( $hWnd, $iParam [, $iStart = -1] )
$hWnd | Control ID/Handle to the control |
$iParam | Param value to search for |
$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. |
Success: | the 0-based index of the item. |
Failure: | -1. |
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
; Warning should not use SetItemParam on items created with GUICtrlCreateListViewItem
; Param is the controlID of the item
Example()
Func Example()
; Create GUI
Local $hGUI = GUICreate("(UDF Created) ListView Find Param (v" & @AutoItVersion & ")", 400, 300)
Local $hListView = _GUICtrlListView_Create($hGUI, "", 2, 2, 394, 268)
GUISetState(@SW_SHOW)
; Set ANSI format
;~ _GUICtrlListView_SetUnicodeFormat($hListView, False)
; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)
; Add items
_GUICtrlListView_BeginUpdate($hListView)
Local $iI
For $iI = 1 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)
; Set item 50 parameter value
_GUICtrlListView_SetItemParam($hListView, 49, 1234)
; Search for target item
$iI = _GUICtrlListView_FindParam($hListView, 1234)
MsgBox($MB_SYSTEMMODAL, "Information", "Target Item Index: " & $iI)
_GUICtrlListView_EnsureVisible($hListView, $iI)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example