Funktionsreferenz

_GUICtrlComboBoxEx_SetTopIndex

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>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Prüft den Klassennamen (ClassName), der an die ComboBox/ComboBoxEx-Funktion übergeben wird. Setze dies versuchsweise auf True und verwende dann ein Handle zu einem anderen Control, um die Funktionsweise zu verstehen.

_Main()

Func _Main()
    Local $hGUI, $hCombo

    ; Erstellt eine GUI
    $hGUI = GUICreate("ComboBoxEx: Stellt sicher, dass ein bestimmtes Item sichtbar ist", 600, 300)
    $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
    GUISetState()

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

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

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

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