Function Reference


_GUICtrlListView_GetTopIndex

Retrieves the index of the topmost visible item when in list or report view

#include <GuiListView.au3>
_GUICtrlListView_GetTopIndex ( $hWnd )

Parameters

$hWnd Control ID/Handle to the control

Return Value


Returns the 0-based index of the item.
    Zero if the list-view control is in icon or small icon view.

Example

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

Example()

Func Example()
        Local $idListview

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

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

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

        ; Select item 50
        _GUICtrlListView_SetItemSelected($idListview, 49)
        _GUICtrlListView_EnsureVisible($idListview, 49)
        MsgBox($MB_SYSTEMMODAL, "Information", "Top Index: " & _GUICtrlListView_GetTopIndex($idListview))

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