Funktionreferenz


_GUICtrlComboBoxEx_SetTopIndex

Beschreibung anzeigen in

Stellt sicher, dass ein bestimmtes Item sichtbar in der ListBox der ComboBox ist

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

Parameter

$hWnd Handle des Controls
$iIndex legt den 0-basierenden Index des Listitems fest

Rückgabewert

Erfolg: True
Fehler: False

Bemerkungen

Das System scrollt den ListBox Inhalt so, dass entweder das festgelegte Item ganz oben in der ListBox erscheint, oder der maximale Scrollbereich erreicht wurde.

- - - - - - - - Erklärung der Controls - - - - - - - -

Verwandte Funktionen

_GUICtrlComboBoxEx_GetTopIndex

Beispiel

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

Example()

Func Example()
    ; Erstellt eine GUI
    Local $hGUI = GUICreate("ComboBoxEx: Setzt und ermittelt das erste sichtbare Item (v" & @AutoItVersion & ")", 600, 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)

    ; Ermittelt das erste sichtbare Item
    MsgBox($MB_SYSTEMMODAL, "Information", "Stellt sicher, dass ein bestimmtes Item sichtbar ist: " & _GUICtrlComboBoxEx_SetTopIndex($hCombo, Random(50, 149, 1)))
    MsgBox($MB_SYSTEMMODAL, "Information", "Ermittelt das erste sichtbare Item: " & _GUICtrlComboBoxEx_GetTopIndex($hCombo))

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