Function Reference

_GUICtrlListSetTopIndex

Ensure that a particular item in a list box is visible

#Include <GuiList.au3>
_GUICtrlListSetTopIndex($h_listbox, $i_index)

 

Parameters

$h_listbox control id/control hWnd
$i_index Specifies the zero-based index of the item

 

Return Value

If an error occurs, the return value is $LB_ERR

 

Remarks

None.

 

Related

_GUICtrlListGetTopIndex

 

Example


#include <GUIConstants.au3>
#include <GuiList.au3>

Opt('MustDeclareVars',1)

Dim $msg, $ret
Dim $listbox,$button,$i

GUICreate("ListBox Set Top Index Demo",400,250,-1,-1)

$listbox = GUICtrlCreateList("",125,40,180,120)
GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
$button = GUICtrlCreateButton("Set Top Index to 4",150,160,120,40)

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListSetTopIndex($listbox,4)
            If($ret == $LB_ERR) Then
                MsgBox(16,"Error","Unknown error from _GUICtrlListSetTopIndex")
            EndIf
    EndSelect
Wend