Checkbox - Wie weiter ?

  • Hi,

    kann vielleich jemand ein kleines Beispiel schreiben, welches sich um Checkbox handelt. Aus Hilfe Datei weiss ich nur wie man ein solches Checkbox erstellt, aber damit kann ich dann gar nicht anfangen.

    zb:
    -Deaktiviert ein Kontrollkästchen --> Jobs A1 , A2 usw. werden erledigt
    -Aktiviert --> Jobs B1 , B2 usw. werden durchgeführt.

    Danke

  • Eine kleine Erweiterung des Hilfe-Beispiels, bittschön:

    [autoit]

    #include <GUIConstants.au3>

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

    GUICreate("My GUI Checkbox") ; will create a dialog box that when displayed is centered

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

    $checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)

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

    $button = GUICtrlCreateButton("Test", 10, 40, 80)

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

    GUISetState () ; will display an dialog box with 1 checkbox

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

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

    If $msg = $button Then
    If GUICtrlRead($checkCN) = $GUI_CHECKED Then
    MsgBox(0, "", "An")
    Else
    MsgBox(0, "", "Aus")
    EndIf
    EndIf

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
  • Danke ..
    es hat viel geholfen. Das war bei Loop Modus. Könnt ihr bitte noch bisschen mehr erklären bei GUIOnEventMode ?
    MFG

  • Simpel:

    [autoit]

    #include <GUIConstants.au3>

    Opt("GUIOnEventMode", 1)
    GUICreate("My GUI Checkbox") ; will create a dialog box that when displayed is centered

    $checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)

    $button = GUICtrlCreateButton("Test", 10, 40, 80)
    GUICtrlSetOnEvent($button, "_Button")

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

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    GUISetState () ; will display an dialog box with 1 checkbox

    ; Run the GUI until the dialog is closed
    While 1
    Sleep(1000)
    Wend

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

    Func _Exit()
    Exit
    EndFunc

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

    Func _Button()
    If GUICtrlRead($checkCN) = $GUI_CHECKED Then
    MsgBox(0, "", "An")
    Else
    MsgBox(0, "", "Aus")
    EndIf
    EndFunc

    [/autoit]

    Den Rest kriegste mit Hilfe und Forum-Suche raus. ;)

    Einmal editiert, zuletzt von unearth (23. November 2007 um 02:44)

  • der status der checkbox läßt sich auch über den Wert auslesen

    [autoit]

    if GUICtrlRead($checkbox]) = 1 then
    ....

    [/autoit]

    Gecheckt = 1
    Ungecheckt = 4