Brauche hilfe bei GUICtrlCreateCheckbox

  • Hallo

    Ich arbeite noch nicht lange mit AutoII.

    Ich versuche gerade etwas mit GUICtrlCreateCheckbox zu progrmmieren.

    [autoit]

    #include <GUIConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 327, 296, 193, 125)
    $Input1 = GUICtrlCreateInput("Grundwert", 64, 50, 169, 20)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1 +5", 64, 80, 100, 20)
    $Checkbox2 = GUICtrlCreateCheckbox("Checkbox1 *2", 64, 110, 100, 20)
    $Checkbox3 = GUICtrlCreateCheckbox("Checkbox1 /3", 64, 140, 100, 20)
    $Button1 = GUICtrlCreateButton("Button1", 64, 176, 169, 33, 0)
    $Label1 = GUICtrlCreateLabel("Label1", 64, 224, 172, 33)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $GrundWert = GUICtrlRead ($Input1)
    $AusgabeWert = $GrundWert
    GUICtrlSetData ($Label1 , $AusgabeWert)
    EndSwitch
    WEnd

    [/autoit]

    Weiter komme ich nicht.


    Wie beomme ich es hin, das wenn der Haken in Checkbox1 +5 und der Butten gedrückt wird auch 5 zum Gerechnet dazu gerechnet wird.

    Kann mir jemand zeigen wie ich es hin bekomme ? Danke im vorraus.

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 327, 296, 193, 125)
    $Input1 = GUICtrlCreateInput("Grundwert", 64, 50, 169, 20)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1 +5", 64, 80, 100, 20)
    $Checkbox2 = GUICtrlCreateCheckbox("Checkbox1 *2", 64, 110, 100, 20)
    $Checkbox3 = GUICtrlCreateCheckbox("Checkbox1 /3", 64, 140, 100, 20)
    $Button1 = GUICtrlCreateButton("Button1", 64, 176, 169, 33, 0)
    $Label1 = GUICtrlCreateLabel("Label1", 64, 224, 172, 33)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $GrundWert = GUICtrlRead($Input1)
    $Ausgabewert = $GrundWert
    ;prüfen ob Checkbox gewählt
    If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
    $Ausgabewert = $GrundWert + 5
    EndIf
    GUICtrlSetData($Label1, $Ausgabewert)

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

    EndSwitch
    WEnd

    [/autoit]
  • Danke für die schnelle Hilfe.

    Das mit den If BitAND ist genau das was ich nicht wuste.

    Die beiden ander habe ich jetzt auch hin bekommen .


    Noch mal Danke


    MfG AlexAlex