Function Reference


_GUICtrlComboBox_SetTopIndex

Ensure that a particular item is visible in the ListBox of a ComboBox

#include <GuiComboBox.au3>
_GUICtrlComboBox_SetTopIndex ( $hWnd, $iIndex )

Parameters

$hWnd Control ID/Handle to the control
$iIndex Specifies the 0-based index of the list item

Return Value

Success: True.
Failure: False.

Remarks

The system scrolls the ListBox contents so that either the specified item appears at the top of the list box or the maximum scroll range has been reached.

Related

_GUICtrlComboBox_GetTopIndex

Example

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
        ; Create GUI
        GUICreate("ComboBox Get/Set TopIndex (v" & @AutoItVersion & ")", 400, 296)
        Local $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_VSCROLL))
        GUISetState(@SW_SHOW)

        ; Add files
        _GUICtrlComboBox_BeginUpdate($idCombo)
        _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe")
        _GUICtrlComboBox_EndUpdate($idCombo)

        ; Set Top Index
        _GUICtrlComboBox_SetTopIndex($idCombo, 10)

        ; Get Top Index
        MsgBox($MB_SYSTEMMODAL, "Information", "Top Index:" & @TAB & _GUICtrlComboBox_GetTopIndex($idCombo))

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