mini Posted March 14, 2010 Share Posted March 14, 2010 (edited) Hey all. Im playing with some check box's, and saving them on a .INI file. All work perfect except one part that I'm not managing to solve my problem. Problem: If I make my GUI read and if i don't have no .INI file or if i don't have no Information for the check box's, they are automatically Tick. Here's my code, hope that someone knows how to solve this little problem. Thanks in advance. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("CheckBox Test", 413, 305) $Save = GUICtrlCreateButton("&Save", 56, 240, 75, 25) $Read = GUICtrlCreateButton("&Read", 154, 240, 75, 25) $Reset = GUICtrlCreateButton("&Reset", 254, 240, 75, 25) $Delete = GUICtrlCreateButton("&Delete", 254, 200, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Local $SNVCheckBoxMH, $previewcheckbox, $msg $SNVCheckBoxMH = GUICtrlCreateCheckbox("&MH", 50, 60, 14, 20) GUICtrlCreateLabel("MH",65,63,40,20) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) $previewcheckbox = GUICtrlCreateCheckbox("&Play result", 50,100,100,100) While 1 $nMsg = GUIGetMsg() Switch $nMsg case -3 _Check4CLOSEClicked() Case $Save _Save() Case $Read _Read() Case $Reset _Reset() Case $Delete _Delete() EndSwitch WEnd func _Save() $answer = MsgBox(36, "Warning", "Save data?", 8 ) If $answer = 6 Then IniWrite("test.ini", "config", "$SNVCheckBoxMH", GUICtrlRead($SNVCheckBoxMH)) IniWrite("test.ini", "config", "$previewcheckbox", GUICtrlRead($previewcheckbox)) EndIf EndFunc func _Read() GUICtrlSetState($previewcheckbox, IniRead("test.ini", "config", "$previewcheckbox", $previewcheckbox)) GUICtrlSetState($SNVCheckBoxMH, IniRead("test.ini", "config", "$SNVCheckBoxMH", $SNVCheckBoxMH)) EndFunc Func _Reset() $answer = MsgBox(36, "Warning", "Reset?", 8 ) If $answer = 6 Then GUICtrlSetState($previewcheckbox, "4") GUICtrlSetState($SNVCheckBoxMH, "4") EndIf EndFunc Func _Delete();Delete the Client INI file $answer = MsgBox(36, "Warning", "You will Delete the test.ini file from Dir?", 8 ) If $answer = 6 Then ;<=================>; FileDelete("test.ini") ;<=================>; EndIf EndFunc Func _Check4CLOSEClicked();Exit $answer = MsgBox(36, "Warning", "Exit?", 8 ) If $answer = 6 Then EndIf Exit EndFunc Edited March 14, 2010 by mini [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 14, 2010 Share Posted March 14, 2010 Maybe you should change that weird default value;IniRead("test.ini", "config", "$previewcheckbox", $previewcheckbox)You do know what the fourth parameter is for, right? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
mini Posted March 14, 2010 Author Share Posted March 14, 2010 (edited) Maybe you should change that weird default value;IniRead("test.ini", "config", "$previewcheckbox", $previewcheckbox)You do know what the fourth parameter is for, right?No mate, I've been removing from some made GUI's all the information.Sow, there are somethings that i don't understand or even don't know, but for your question, I see that I'm making a big mistake.Can you clarify me on the 4 Parameter's please!! Edit: Ok, i think i found what i made wrong, 4th Parameter = Default, sow, the Default value for the Check Box to be "blank" is 4, sow i just Change the 4th parameter to "4" and its working well...Thans very much for the ear push. Edited March 14, 2010 by mini [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. Link to comment Share on other sites More sharing options...
dani Posted March 14, 2010 Share Posted March 14, 2010 Can you clarify me on the 4 Parameter's please!! Did you not read the IniRead documentation ? Link to comment Share on other sites More sharing options...
mini Posted March 14, 2010 Author Share Posted March 14, 2010 Did you not read the IniRead documentation ? Yes, went there after replaying Heres the Full Working program expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("CheckBox Test", 413, 305) $Save = GUICtrlCreateButton("&Save", 56, 240, 75, 25) $Read = GUICtrlCreateButton("&Read", 154, 240, 75, 25) $Reset = GUICtrlCreateButton("&Reset", 254, 240, 75, 25) $Delete = GUICtrlCreateButton("&Delete", 254, 200, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Local $SNVCheckBoxMH, $previewcheckbox, $msg $SNVCheckBoxMH = GUICtrlCreateCheckbox("&MH", 50, 60, 14, 20) GUICtrlCreateLabel("MH",65,63,40,20) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) $previewcheckbox = GUICtrlCreateCheckbox("&Play result", 50,100,100,100) While 1 $nMsg = GUIGetMsg() Switch $nMsg case -3 _Check4CLOSEClicked() Case $Save _Save() Case $Read _Read() Case $Reset _Reset() Case $Delete _Delete() EndSwitch WEnd func _Save() $answer = MsgBox(36, "Warning", "Save data?", 8 ) If $answer = 6 Then IniWrite("test.ini", "config", "$SNVCheckBoxMH", GUICtrlRead($SNVCheckBoxMH)) IniWrite("test.ini", "config", "$previewcheckbox", GUICtrlRead($previewcheckbox)) EndIf EndFunc func _Read() GUICtrlSetState($previewcheckbox, IniRead("test.ini", "config", "$previewcheckbox", "4")) GUICtrlSetState($SNVCheckBoxMH, IniRead("test.ini", "config", "$SNVCheckBoxMH", "4")) EndFunc Func _Reset() $answer = MsgBox(36, "Warning", "Reset?", 8 ) If $answer = 6 Then GUICtrlSetState($previewcheckbox, "4") GUICtrlSetState($SNVCheckBoxMH, "4") EndIf EndFunc Func _Delete();Delete the Client INI file $answer = MsgBox(36, "Warning", "You will Delete the test.ini file from Dir?", 8 ) If $answer = 6 Then ;<=================>; FileDelete("test.ini") ;<=================>; EndIf EndFunc Func _Check4CLOSEClicked();Exit $answer = MsgBox(36, "Warning", "Exit?", 8 ) If $answer = 6 Then EndIf Exit EndFunc [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now