Function Reference


_GUICtrlComboBox_GetTopIndex

Retrieve the 0-based index of the first visible item in the ListBox portion of a ComboBox

#include <GuiComboBox.au3>
_GUICtrlComboBox_GetTopIndex ( $hWnd )

Parameters

$hWnd Control ID/Handle to the control

Return Value

Success: the index of the first visible item in the ListBox of the ComboBox.
Failure: -1.

Related

_GUICtrlComboBox_SetTopIndex

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