• Was hat es eigentlich mit diesen Dummycontrols auf sich? Ich finde dazu irgendwie nix.

    Projekte: Keine größeren (und fertigen)
    Gegen Internetzensur:
    https://epetitionen.bundestag.de/index.php?acti…s;petition=3860
    (Zeichnungsfrist abgelaufen)
    __________________________________________________________________________________________________________________________________
    Dieser Beitrag wurde bereits 264 mal editiert, zuletzt von »Fast2« (30. Februar 2009, 12:99)

    • Offizieller Beitrag

    Hallo

    Ein Dummy wird sehr selten verwendet, kann aber z.B. für folgende Funktion verwendet werden:

    Viele Checkboxes Automatisch auf Checked stellen
    [autoit]

    #include <GUIConstants.au3>

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

    $GUI = GUICreate("There once were 50 checkboxes", 200, 850)

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

    $CheckboxesStart = GUICtrlCreateDummy() ; ==> Notice the start
    For $i = 0 To 49
    GUICtrlCreateCheckbox("Checkbox " & $i+1, 0,0+($i*17)) ; ==> Obviously I'm not going to create 50 variables for 50 checkboxes cause this is just for showing how to check every single one.
    Next ; I read you do, so be sure to create all checkboxes at the same place and surround them by 2 dummy controls.
    $CheckboxesStop = GUICtrlCreateDummy() ; ==> Notice the end

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

    $CheckAll = GUICtrlCreateButton("Check all", 100, 100)
    $UnCheckAll = GUICtrlCreateButton("Uncheck all", 100, 130)

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

    GUISetState()

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

    While 1
    $Msg = GUIGetMsg()

    Switch $Msg
    Case $CheckAll
    For $i = $CheckboxesStart to $CheckboxesStop ; ==> Looping through every checkbox
    GUICtrlSetState($i, $GUI_CHECKED)
    Next
    Case $UnCheckAll
    For $i = $CheckboxesStart to $CheckboxesStop ; ==> Looping through every checkbox
    GUICtrlSetState($i, $GUI_UNCHECKED)
    Next
    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch
    WEnd

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

    GUIDelete()

    [/autoit]

    Mfg Spider

  • Ah! Danke, das ist doch mal nicht schlecht. :D
    Endlich weiß ich mal was man damit machen kann.

    Projekte: Keine größeren (und fertigen)
    Gegen Internetzensur:
    https://epetitionen.bundestag.de/index.php?acti…s;petition=3860
    (Zeichnungsfrist abgelaufen)
    __________________________________________________________________________________________________________________________________
    Dieser Beitrag wurde bereits 264 mal editiert, zuletzt von »Fast2« (30. Februar 2009, 12:99)

    • Offizieller Beitrag

    HI,

    hmmh warum dann nicht gleich so?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    $GUI = GUICreate("There once were 50 checkboxes", 200, 850)
    Global $cb[50]

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

    For $i = 0 To 49
    $cb[$i] = GUICtrlCreateCheckbox("Checkbox " & $i + 1, 0, 0 + ($i * 17)) ; ==> Obviously I'm not going to create 50 variables for 50 checkboxes cause this is just for showing how to check every single one.
    Next ; I read you do, so be sure to create all checkboxes at the same place and surround them by 2 dummy controls.

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

    $CheckAll = GUICtrlCreateButton("Check all", 100, 100)
    $UnCheckAll = GUICtrlCreateButton("Uncheck all", 100, 130)

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

    GUISetState()

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

    While 1
    $Msg = GUIGetMsg()

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

    Switch $Msg
    Case $CheckAll
    For $i = 0 To UBound($cb) - 1 ; ==> Looping through every checkbox
    GUICtrlSetState($cb[$i], $GUI_CHECKED)
    Next
    Case $UnCheckAll
    For $i = 0 To UBound($cb) - 1 ; ==> Looping through every checkbox
    GUICtrlSetState($cb[$i], $GUI_UNCHECKED)
    Next
    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch
    WEnd

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

    GUIDelete()

    [/autoit]

    So long,

    Mega

    bernd670: Include-Zeile korrigiert! Bitte zum einfügen von Quellcode den Editor in den Quellcodemodus schalten, ansonsten werden die spitzen Klammern als HTML-Tags interpretiert!