Function Reference


_GUICtrlComboBoxEx_SetTopIndex

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

#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetTopIndex ( $hWnd, $iIndex )

Parameters

$hWnd 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

_GUICtrlComboBoxEx_GetTopIndex

Example

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

Example()

Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("ComboBoxEx Get/Set Top Index (v" & @AutoItVersion & ")", 400, 300)
        Local $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 : string", $x))
        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