;Quizzz Vers 2.0
#include <GUIConstants.au3>
$QuizzGui = GUICreate("Quiz GUI", 250, 500)
$Question = GUICtrlCreateLabel("RawrRawr", 10, 10)
; Different types of GUI stuff:
$button = GUICtrlCreateButton( "This is a button | o", 10, 10, 240, 22 )
$checkboxTxt = "This is a checkbox" ;This is used for submission purposes
$checkbox = GUICtrlCreateCheckbox( $checkboxTxt, 10, 40 )
$input = GUICtrlCreateInput( "Enter something", 10, 70, 200)
$inputOK = GUICtrlCreateButton( "ok", 210, 70, 30, 22 )
; +Submit Button
$Submit = GUICtrlCreateButton( "This is a submit button", 10, 100, 240, 22 )
GUISetState() ;Showtime
;Funky
Func btn_toggle($hBtn, $sTrue, $sFalse)
If GUICtrlRead($hBtn) = $sTrue Then
GUICtrlSetData($hBtn, $sFalse)
Else
GUICtrlSetData($hBtn, $sTrue)
EndIf
EndFunc
Func input_toggle($hInput, $hBtn, $sTrue, $sFalse)
If GUICtrlRead($hBtn) = $sTrue Then
GUICtrlSetData($hBtn, $sFalse)
GUICtrlSetState( $hInput, $GUI_DISABLE )
Else
GUICtrlSetData($hBtn, $sTrue)
GUICtrlSetState( $hInput, $GUI_ENABLE )
EndIf
EndFunc
Func SubmitFunction()
local $iniString
;Button
If GUICtrlRead($button) = "This is a button | x" Then ; 1 is hooked, 4 is not
If Not $iniString = "" Then $iniString &= ", "
$iniString &= GUICtrlRead($button)
EndIf
#CS ;Alternatly, save the button text as is. clicked or not
If Not $iniString = "" Then $iniString &= ", "
$iniString &= GUICtrlRead($button)
#CE
;Checkbox
If GUICtrlRead($checkbox) = 1 Then ; 1 is hooked, 4 is not
If Not $iniString = "" Then $iniString &= ", "
$iniString &= $checkboxTxt
EndIf
;Input
If GUICtrlRead($inputOK) = "edit" Then ;Means 'ok' was pressed
If Not $iniString = "" Then $iniString &= ", "
$iniString &= GUICtrlRead($input)
EndIf
;Note: the above could easily be converted into a function
IniWrite("save.ini", "section z", "Bomi (An)swe(a)rs", $iniString)
MsgBox(0, "RAWR", IniRead("save.ini", "section z", "Bomi (An)swe(a)rs", "Reading save.ini failed!"))
Exit
EndFunc
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then
Exit
ElseIf $msg = $button Then
btn_toggle($button, "This is a button | o", "This is a button | x")
ElseIf $msg = $inputOK Then
input_toggle($input, $inputOK, "ok", "edit")
ElseIf $msg = $Submit Then
SubmitFunction()
EndIf
WEnd
This was(/is?) a fun challenge.
Did i get it right this time?
I beg to differ. Although mind reading over distance can be quite difficult