Checkbox + Radio

  • Guten Tag liebe Community von AutoIt.de

    Ich hatte mal ein bisschen nach meinem Problem gegooglet, aber so richtig zur lösung gekommen bin ich leider nicht ...
    Dann hat google mir die Seite https://autoit.de/www.autoit.de ausgespuckt, und ich wollte mal gucken was hier so ist, und ich hoffe ihr könnt mir helfen...

    Spoiler anzeigen
    [autoit]

    #include #include #include #Region ### START Koda GUI section ### Form=$Form2 = GUICreate("Form2", 413, 298, 302, 218)$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 148, 14, 97, 17)$Radio1 = GUICtrlCreateRadio("Radio1", 150, 34, 113, 17)GUICtrlSetState(-1, $GUI_DISABLE)$Radio2 = GUICtrlCreateRadio("Radio2", 150, 56, 113, 17)GUICtrlSetState(-1, $GUI_DISABLE)$Button1 = GUICtrlCreateButton("Button1", 150, 78, 75, 25, $WS_GROUP)GUICtrlSetState(-1, $GUI_DISABLE)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###
    While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExit
    Case $Checkbox1

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

    EndSwitchWEnd

    [/autoit]


    Im Spoiler ist jetzt meine GUI, und auf klick von Checkbox1, sollen die Radio's aktiviert werden...

    Mit

    [autoit]

    $GUI_ENABLE , $GUI_DISABLE

    [/autoit]


    habe ich schon mal etwas gemacht, aber ich weiß nicht wie er ausliest ob sie gecheckt ist, oder nicht...
    Und die Radio's soll er dann auch auslesen, je nachdem welche Radio angewählt ist sollte er den Button enablen, oder wieder disablen...


    Vielen dank an Oscar für die nette Hilfe :)

    Einmal editiert, zuletzt von SysChance (17. April 2010 um 12:10)

  • In etwa so?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    $hGui = GUICreate("Gui", 200, 200)
    $hCheck = GUICtrlCreateCheckbox("Radios aktivieren", 10, 10)
    $hRadio1 = GUICtrlCreateRadio("Radio 1", 10, 50)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $hRadio2 = GUICtrlCreateRadio("Radio 2", 10, 70)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $hRadio3 = GUICtrlCreateRadio("Radio 3", 10, 90)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetState()

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

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    Case $hCheck
    If BitAnd(GUICtrlRead($hCheck),$GUI_CHECKED) Then
    GUICtrlSetState($hRadio1, $GUI_ENABLE)
    GUICtrlSetState($hRadio2, $GUI_ENABLE)
    GUICtrlSetState($hRadio3, $GUI_ENABLE)
    Else
    GUICtrlSetState($hRadio1, $GUI_DISABLE)
    GUICtrlSetState($hRadio2, $GUI_DISABLE)
    GUICtrlSetState($hRadio3, $GUI_DISABLE)
    EndIf
    EndSwitch
    WEnd

    [/autoit]

    Lad dir erstmal die deutsche Hilfe runter, falls du sie noch nicht hast.

  • m-obi,

    ich habe es so gemacht, ich habe deinen beitrag noch nicht gesehen gehabt:


    [autoit]

    #include #include #include #Region ### START Koda GUI section ### Form=$Form2 = GUICreate("Form2", 413, 298, 302, 218)$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 148, 14, 97, 17)$Radio1 = GUICtrlCreateRadio("Radio1", 150, 34, 113, 17)GUICtrlSetState(-1, $GUI_DISABLE)$Radio2 = GUICtrlCreateRadio("Radio2", 150, 56, 113, 17)GUICtrlSetState(-1, $GUI_DISABLE)$Button1 = GUICtrlCreateButton("Button1", 150, 78, 75, 25, $WS_GROUP)GUICtrlSetState(-1, $GUI_DISABLE)$Button2 = GUICtrlCreateButton("Button2", 150, 102, 75, 25, $WS_GROUP)GUICtrlSetState(-1, $GUI_DISABLE)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###
    While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExit
    Case $Checkbox1If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) ThenGUICtrlSetState ($Radio1, $GUI_ENABLE)GUICtrlSetState ($Radio2, $GUI_ENABLE)ElseIf NOT BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) ThenGUICtrlSetState ($Radio1, $GUI_DISABLE)GUICtrlSetState ($Radio2, $GUI_DISABLE)EndIf
    Case $Radio1If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) and NOT BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) ThenGUICtrlSetState ($Button1, $GUI_ENABLE)GUICtrlSetState ($Button2, $GUI_DISABLE)EndIf
    Case $Radio2If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) and NOT BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) ThenGUICTrlSetState ($Button1, $GUI_DISABLE)GUICtrlSetState ($Button2, $GUI_ENABLE)EndIf

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

    EndSwitchWEnd

    [/autoit]


    So, ich mache es noch mal offen, weil ich noch eine letzte frage habe...

    Wenn ich jetzt die Checkbox 1 rausnehme, soll auch keine Radio mehr angewählt sein, dass geht wie ?

    EDIT//

    Huch ?
    Warum postet er meinen code so komisch :(

  • -,- jetzt habt ihr ihm schön alles vorgearbeitet

    ich geb ihm 2 sachen mit dem er das gut machen kann und ihr schiebt ihm die gabel gleich in den mund
    -,-


    Edit\\

    GuiCtrlSetData(...)
    wieder!
    und lasst ihn wenigstens diesmal nen bissel rumprobieren!

    MfG
    Alizame

  • Hier der Code nochmal formatiert ^^

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form2", 413, 298, 302, 218)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 148, 14, 97, 17)
    $Radio1 = GUICtrlCreateRadio("Radio1", 150, 34, 113, 17)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Radio2 = GUICtrlCreateRadio("Radio2", 150, 56, 113, 17)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Button1", 150, 78, 75, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button2 = GUICtrlCreateButton("Button2", 150, 102, 75, 25, $WS_GROUP)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $Checkbox1
    If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
    GUICtrlSetState ($Radio1, $GUI_ENABLE)
    GUICtrlSetState ($Radio2, $GUI_ENABLE)
    ElseIf NOT BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
    GUICtrlSetState ($Radio1, $GUI_DISABLE)
    GUICtrlSetState ($Radio2, $GUI_DISABLE)
    EndIf

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

    Case $Radio1
    If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) and NOT BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) Then
    GUICtrlSetState ($Button1, $GUI_ENABLE)
    GUICtrlSetState ($Button2, $GUI_DISABLE)
    EndIf

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

    Case $Radio2
    If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) and NOT BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then
    GUICTrlSetState ($Button1, $GUI_DISABLE)
    GUICtrlSetState ($Button2, $GUI_ENABLE)
    EndIf

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

    EndSwitch
    WEnd

    [/autoit]

    21 is only half the truth.

  • Danke Alizame, ich werde mal gucken was die Hilfe sagt... :)

    [autoit]

    #include <ButtonConstants.au3>#include <GUIConstantsEx.au3>#include <WindowsConstants.au3>#Region ### START Koda GUI section ### Form=$Form2 = GUICreate("Form2", 413, 298, 302, 218)$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 148, 14, 97, 17)$Radio1 = GUICtrlCreateRadio("Radio1", 150, 34, 113, 17)GUICtrlSetState(-1, $GUI_DISABLE)$Radio2 = GUICtrlCreateRadio("Radio2", 150, 56, 113, 17)GUICtrlSetState(-1, $GUI_DISABLE)$Button1 = GUICtrlCreateButton("Button1", 150, 78, 75, 25, $WS_GROUP)GUICtrlSetState(-1, $GUI_DISABLE)$Button2 = GUICtrlCreateButton("Button2", 150, 102, 75, 25, $WS_GROUP)GUICtrlSetState(-1, $GUI_DISABLE)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###
    While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExit
    Case $Checkbox1If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) ThenGUICtrlSetState ($Radio1, $GUI_ENABLE)GUICtrlSetState ($Radio2, $GUI_ENABLE)ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) ThenGUICtrlSetState ($Radio1, $GUI_DISABLE)GUICtrlSetState ($Radio2, $GUI_DISABLE)GUICtrlSetState ($Radio1, $GUI_UNCHECKED)GUICtrlSetState ($Radio2, $GUI_UNCHECKED)GUICtrlSetState ($Button1, $GUI_DISABLE)GUICtrlSetState ($Button2, $GUI_DISABLE)EndIf
    Case $Radio1If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) and NOT BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) ThenGUICtrlSetState ($Button1, $GUI_ENABLE)GUICtrlSetState ($Button2, $GUI_DISABLE)EndIf
    Case $Radio2If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) and NOT BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) ThenGUICTrlSetState ($Button1, $GUI_DISABLE)GUICtrlSetState ($Button2, $GUI_ENABLE)EndIf

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

    EndSwitchWEnd

    [/autoit]