Checkbox mit Combibox oder dropdown list

  • Hallo zusammen immoment habe ich die Checkboxen kann ich diese auch in eine Combibox oder eine Drop Downliste machen?

    Spoiler anzeigen
    [autoit]


    $Form1 = GUICreate("Allgemein", 615, 438, 192, 124);erstellt die GUI
    $Checkbox1 = GUICtrlCreateCheckbox("Hallo1", 80, 60, 97, 17);erstellt die Checkbox
    $Checkbox2 = GUICtrlCreateCheckbox("Hallo2", 80, 80, 97, 17)
    $Checkbox3 = GUICtrlCreateCheckbox("Hallo3", 80, 100, 97, 17)
    $Checkbox4 = GUICtrlCreateCheckbox("Hallo4", 80, 120, 97, 17)
    $Checkbox5 = GUICtrlCreateCheckbox("Hallo5", 80, 140, 97, 17)
    $Checkbox6 = GUICtrlCreateCheckbox("Hallo6", 80, 160, 97, 17)
    $Okay = GUICtrlCreateButton("Okay", 328, 360, 129, 41);erstellt einen okay button
    $Abbrechen = GUICtrlCreateButton("Abbrechen", 456, 360, 129, 41)
    $Label1 = GUICtrlCreateLabel("Hallo?", 216, 24, 136, 17);Überschrift
    $Alle = GUICtrlCreateButton("Alle", 200, 360, 129, 41)
    $keine= GUICtrlCreateButton("Keine",72,360,129,41)
    $GUI1 = GUISetState(@SW_SHOW)

    [/autoit]
  • Ich habe die Fage so verstanden, dass ich sagen muss das es nicht sooo einfach funktioniert.

    Hier mein Lösungsvorschlag

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGui = GUICreate("ComboBox with checkboxes", 300, 300)
    GUIRegisterMsg(0x111, "_WM_COMMAND")

    [/autoit] [autoit][/autoit] [autoit]

    Global $hCombo = GUICtrlCreateCombo("Choose option", 10, 10, 100, 0, 0x3)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hMenu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
    Global $nOpt1 = GUICtrlCreateMenuItem("Option1", $hMenu, -1, 1)
    GUICtrlSetState(-1, $GUI_CHECKED)
    Global $nOpt2 = GUICtrlCreateMenuItem("Option2", $hMenu, -1, 1)
    Global $nOpt3 = GUICtrlCreateMenuItem("Option3", $hMenu, -1, 1)
    GUICtrlCreateMenuItem("", $hMenu)
    Global $nOpt4 = GUICtrlCreateMenuItem("Option4", $hMenu, -1, 0)
    GUICtrlSetState(-1, $GUI_CHECKED)
    Global $nOpt5 = GUICtrlCreateMenuItem("Option5", $hMenu, -1, 0)
    Global $nOpt6 = GUICtrlCreateMenuItem("Option6", $hMenu, -1, 0)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(1000)

    [/autoit] [autoit][/autoit] [autoit]

    Local $msg
    Do
    $msg = GUIGetMsg()
    Switch $msg
    Case $nOpt4 To $nOpt6
    If BitAND(GUICtrlRead($msg), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($msg, $GUI_UNCHECKED)
    Else
    GUICtrlSetState($msg, $GUI_CHECKED)
    EndIf
    EndSwitch
    Until $msg = -3

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $nID = BitAND($wParam, 0x0000FFFF)

    If $nID = $hCombo And $nNotifyCode = 7 Then
    GUICtrlSendMsg($hCombo, 335, 1, 0)
    ShowMenu($hGui, $hCombo, $hMenu)
    GUICtrlSendMsg($hCombo, 335, 1, 0)
    EndIf

    Return "GUI_RUNDEFMSG"
    EndFunc ;==>MY_WM_COMMAND

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Show a menu in a given GUI window which belongs to a given GUI ctrl
    Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)

    $arPos = ControlGetPos($hWnd, "", $CtrlID)

    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]

    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
    EndFunc ;==>ShowMenu

    [/autoit] [autoit][/autoit] [autoit]

    ; Convert the client (GUI) coordinates to screen (desktop) coordinates
    Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
    EndFunc ;==>ClientToScreen

    [/autoit] [autoit][/autoit] [autoit]

    ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
    Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
    EndFunc ;==>TrackPopupMenu

    [/autoit]