Function Reference


_GUICtrlComboBoxEx_GetTopIndex

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

#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetTopIndex ( $hWnd )

Parameters

$hWnd Handle to the control

Return Value

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

Related

_GUICtrlComboBoxEx_SetTopIndex

Example

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

Example()

Func Example()
    Local $hGUI, $hCombo

    ; Create GUI
    $hGUI = GUICreate("ComboBoxEx Get Top Index", 400, 300)
    $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
    GUISetState(@SW_SHOW)

    _GUICtrlComboBoxEx_InitStorage($hCombo, 150, 300)
    _GUICtrlComboBoxEx_BeginUpdate($hCombo)

    For $x = 0 To 149
        _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
    Next
    _GUICtrlComboBoxEx_EndUpdate($hCombo)

    ;Set Top Index
    MsgBox($MB_SYSTEMMODAL, "Information", "Set Top Index: " & _GUICtrlComboBoxEx_SetTopIndex($hCombo, Random(50, 149, 1)))
    MsgBox($MB_SYSTEMMODAL, "Information", "Top Index: " & _GUICtrlComboBoxEx_GetTopIndex($hCombo))

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example