Tag GodLikerz
Heute zeige ich euch wie ihr Checkboxen, Radio Buttons MsgBoxen etc. ausliest.
[FELD="Inahlt:"]1. Checkboxen
2. RadioButtons
3. MsgBoxes
[/FELD]
1. Checkboxen
Beispiel:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 192, 136, 192, 124)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 40, 24, 97, 17)
$Button1 = GUICtrlCreateButton("Button1", 40, 48, 115, 57, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
[I][B][COLOR=Red]Case $Button1
If GuiCtrlRead($CheckBox1) = 1 Then ;Wenn angeklickt dann...
MsgBox(0, "ANgeklickt", "Du hattest die Checkbox angeglickt")
Else
MsgBox(0, "Nicht Angeklickt", "Du hattest die Checkbox nicht angeglickt")
EndIf[/COLOR][/B][/I]
EndSwitch
WEnd
Alles anzeigen
Hier nehmt man Die If Schleifen und liest die CheckBox mit GuiCtrlread($var) aus.
2. Radio Buttons
Beispiel:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 192, 136, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 40, 48, 115, 57, $WS_GROUP)
$Ja = GUICtrlCreateRadio("Radio1", 48, 8, 113, 17)
$Nein = GUICtrlCreateRadio("Radio2", 48, 24, 113, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
[I][COLOR=Red][B]Case $Button1
If GUiCtrlRead($Ja) = 1 then
MsgBox(0, "Ja", "Du hattest Ja ausgewählt")
EndIf
If GUiCtrlRead($Nein) = 1 then
MsgBox(0, "Nein", "Du hattest nein ausgewählt")
EndIf
[/B][/COLOR][/I]
EndSwitch
WEnd
Alles anzeigen
Hier genauso wie bei checkBox
3. MsgBoxen
Was ist gemeint:
Wenn man zB
Machund ID "4" auswählt - 4 Steht für Ja & Nein Button.
Dann will man ja verschiedene Funktionen zwischen Ja und Nein.
[COLOR=Red][I][B]$Msg[/B][/I][/COLOR] = MsgBox([B][COLOR=Red]4[/COLOR][/B], "Titel", "Text")
[I][B][COLOR=Red]If $Msg = 7 Then ;Wenn nein dann...
Exit ;Schliessen
Else
MsgBox(0, "Ja", "Du hast Ja geklickt!!!")[/COLOR][/B][/I]
Hier muss man die MsgBox in eine Variable packen.
Die Msg Ids und Ids der Ja& Nein buttons etc. könnt ihr in der HelpFile Schauen...
So finde ich es in der helpfile:
Ihr öffnet die Helfile und klickt auf "Funktion Reference"

Dannach kklickt ihr auf "Message Boxes and Dialogs"

Und nun noch auf MsgBox:

Dort findet ihr alles.
Viel Spass beim Coden
MFG
xDrago