Was hat es eigentlich mit diesen Dummycontrols auf sich? Ich finde dazu irgendwie nix.
Dummycontrols?
-
-
- 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
[/autoit] [autoit][/autoit] [autoit]
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$CheckAll = GUICtrlCreateButton("Check all", 100, 100)
[/autoit] [autoit][/autoit] [autoit]
$UnCheckAll = GUICtrlCreateButton("Uncheck all", 100, 130)GUISetState()
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$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
WEndGUIDelete()
[/autoit]Mfg Spider
-
Ah! Danke, das ist doch mal nicht schlecht.
Endlich weiß ich mal was man damit machen kann. -
- 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)
[/autoit] [autoit][/autoit] [autoit]
Global $cb[50]For $i = 0 To 49
[/autoit] [autoit][/autoit] [autoit]
$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.$CheckAll = GUICtrlCreateButton("Check all", 100, 100)
[/autoit] [autoit][/autoit] [autoit]
$UnCheckAll = GUICtrlCreateButton("Uncheck all", 100, 130)GUISetState()
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$Msg = GUIGetMsg()Switch $Msg
[/autoit] [autoit][/autoit] [autoit]
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
WEndGUIDelete()
[/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!
-
- Offizieller Beitrag
Hallo
Naja.. du musst kein Array erstellen
Aber, es stimmt schon, Dummy Controls werden eigentlich nie benutzt, keine Ahnung warum "die" die reingebaut haben
Mfg Spider