Funktionreferenz


_GUICtrlComboBoxEx_Create

Beschreibung anzeigen in

Erstellt ein ComboBoxEx-Control

#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_Create ( $hWnd, $sText, $iX, $iY [, $iWidth = 100 [, $iHeight = 200 [, $iStyle = 0x00200002 [, $iExStyle = 0x00000000]]]] )

Parameter

$hWnd Handle zum Parent- oder Eigner-Fenster
$sText Getrennter String der der ComboBox hinzugefügt werden soll
$iX Horizontale Position des Controls
$iY Vertikale Position des Controls
$iWidth [optional] Breite des Controls
$iHeight [optional] Höhe des Controls im ausgeklappten Zustand
$iStyle [optional] Stile des Controls:
    $CBS_DROPDOWN - Ähnlich wie $CBS_SIMPLE. Erwartet, dass die ListBox nicht dargestellt wird, außer der Benutzer markiert ein Icon nach dem Edit-Control
    $CBS_DROPDOWNLIST - Ähnlich wie $CBS_DROPDOWN. Erwartet, dass das Edit-Control durch ein statisches Textitem ersetzt wird, welches die aktuelle Markierung in der ListBox darstellt
    $CBS_SIMPLE - Zeigt die Auswahlliste immer an.

Standard: $CBS_DROPDOWN, $WS_VSCROLL
Erzwungen: $WS_CHILD, $WS_TABSTOP, $WS_VISIBLE
$iExStyle [optional] erweiterte Stile des Controls:
    $CBES_EX_CASESENSITIVE - Es wird bei der Suche auch auf die Groß- und Kleinschreibung geachtet
    $CBES_EX_NOEDITIMAGE - Die Editbox und die Dropdown Liste zeigen keine Itembilder an
    $CBES_EX_NOEDITIMAGEINDENT - Die Editbox und die Dropdown Liste zeigen keine Itembilder an
    $CBES_EX_NOSIZELIMIT - Erlaubt es dem ComboBoxEx-Control vertikal kleiner zu sein als dessen enthaltenes ComboBox Control

Rückgabewert

Erfolg: das Handle zu dem Listbox Control
Fehler: 0

Bemerkungen

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

Verwandte Funktionen

_GUICtrlComboBoxEx_Destroy

Beispiel

#include <Extras\WM_NOTIFY.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $g_hCombo

Example()

Func Example()
    ; Erstellt eine GUI
    Local $hGUI = GUICreate("ComboBoxEx: Erstellen (v" & @AutoItVersion & ")", 400, 300)
    $g_hCombo = _GUICtrlComboBoxEx_Create($hGUI, "Dies ist ein Test|Zeile 2", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    _WM_NOTIFY_Register()

    _GUICtrlComboBoxEx_AddString($g_hCombo, "Etwas mehr Text")
    _GUICtrlComboBoxEx_InsertString($g_hCombo, "zu löschender Text", 1)
    _GUICtrlComboBoxEx_DeleteString($g_hCombo, 1)
    _GUICtrlComboBoxEx_InsertString($g_hCombo, "Eingefügter Text", 1)

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    Local $iCode = DllStructGetData($tNMHDR, "Code")
    Local $tInfo
    Switch $hWndFrom
        Case $g_hCombo
            Switch $iCode
                Case $CBEN_BEGINEDIT ; Gesendet, wenn der Benutzer die Aufklappliste aktiviert oder in das Input-Control des Controls klickt.
                    _WM_NOTIFY_DebugEvent("$CBEN_BEGINEDIT", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                    Return 0
                Case $CBEN_DELETEITEM
                    _WM_NOTIFY_DebugEvent("$CBEN_DELETEITEM", $tagNMCOMBOBOXEX, $lParam, "IDFrom,,Mask,Item,*Text,TextMax,Indent,Image,SelectedImage,OverlayImage,Param")
                    Return 0
                Case $CBEN_DRAGBEGINA, $CBEN_DRAGBEGINW
                    $tInfo = DllStructCreate($tagNMCBEDRAGBEGIN, $lParam)
                    If DllStructGetData($tInfo, "ItemID") Then
                        _WM_NOTIFY_DebugEvent("$CBEN_DRAGBEGIN", $tagNMCOMBOBOXEX, $lParam, "IDFrom,,Mask,Item,*Text,TextMax,Indent,Image,SelectedImage,OverlayImage,Param")
                    EndIf
                    _WM_NOTIFY_DebugEvent("$CBEN_DRAGBEGIN", $tagNMCBEDRAGBEGIN, $lParam, "IDFrom,,ItemID,Text")
                    ; Rückgabe auslassen
                Case $CBEN_ENDEDITA, $CBEN_ENDEDITW ; Gesendet, wenn der Benutzer eine Operation in dem Input-Control beendet hat oder ein Item aus der Aufklappliste des Controls ausgewählt hat.
                    _WM_NOTIFY_DebugEvent("$CBEN_ENDEDIT", $tagNMCBEENDEDIT, $lParam, "IDFrom,,fChanged,NewSelection,Text,Why")
                    Return False ; Akzeptiert die Benachrichtigung und erlaubt dem Control das gewählte Item anzuzeigen
;~                  Return True  ; Andernfalls
                Case $CBEN_GETDISPINFOA, $CBEN_GETDISPINFOW ; Gesendet, um Anzeigeinformationen über das Callback-Item abzurufen
                    _WM_NOTIFY_DebugEvent("$CBEN_GETDISPINFOW", $tagNMCOMBOBOXEX, $lParam, "IDFrom,,Mask,Item,*Text,TextMax,Indent,Image,SelectedImage,OverlayImage,Param")
                    Return 0
                Case $CBEN_INSERTITEM
                    _WM_NOTIFY_DebugEvent("$CBEN_INSERTITEM", $tagNMCOMBOBOXEX, $lParam, "IDFrom,,Mask,Item,*Text,TextMax,Indent,Image,SelectedImage,OverlayImage,Param")
                    Return 0
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY