Function Reference


_GUICtrlListView_GetNextItem

Searches for an item that has the specified properties

#include <GuiListView.au3>
_GUICtrlListView_GetNextItem ( $hWnd [, $iStart = -1 [, $iSearch = 0 [, $iState = 8]]] )

Parameters

$hWnd Control ID/Handle to the control
$iStart [optional] Index of the item to begin the search with, or -1 to find the first item that matches the specified flags.
The specified item itself is excluded from the search.
$iSearch [optional] Relationship to the index of the item where the search is to begin:
    0 - Searches for a subsequent item by index
    1 - Searches for an item that is above the specified item
    2 - Searches for an item that is below the specified item
    3 - Searches for an item to the left of the specified item
    4 - Searches for an item to the right of the specified item
$iState [optional] State of the item to find. Can be a combination of:
    1 - The item is cut
    2 - The item is highlighted
    4 - The item is focused
    8 - The item is selected

Return Value

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

Example

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

Example()

Func Example()
        Local $idListview

        GUICreate("ListView Get Next Item", 400, 300)
        $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; Add columns
        _GUICtrlListView_AddColumn($idListview, "Items", 100)

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Item 1")
        _GUICtrlListView_AddItem($idListview, "Item 2")
        _GUICtrlListView_AddItem($idListview, "Item 3")

        ; Select item 2
        _GUICtrlListView_SetItemSelected($idListview, 1)

        ; Find selected item
        MsgBox($MB_SYSTEMMODAL, "Information", "Selected Item: " & _GUICtrlListView_GetNextItem($idListview))

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