McGod Posted August 27, 2006 Posted August 27, 2006 Ok, so I'm coding a GUI config that uses SQLite. I've been working on the save part of it. Now when it comes to checkboxs its pissing me off. There is no way to tell what control is what. I need to convert 1($GUI_CHECKED) and 4($GUI_UNCHECKED) to Yes and No. Now i tried using GUICtrlRead ( $checkbox, 1) which would give me its name then i would name all checkboxes CB but the GUICtrlRead starting screwing up and not giving name so i cant use it anymore. My Question is: Is there any sure proof method to figure out what control is what? [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
Helge Posted August 27, 2006 Posted August 27, 2006 (edited) I'm a little bit unsure but I think this does what you want :#include <GUIConstants.au3> GUICreate("", 100, 40) $checkbox = GUICtrlCreateCheckbox ("No", 10, 10, 180, 20) GUISetState() While 1 $iMsg = GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Then ExitLoop If $iMsg = $checkbox Then If BitAND(GUICtrlRead($checkbox), $GUI_CHECKED) Then GUICtrlSetData($checkbox, "Yes") Else GUICtrlSetData($checkbox, "No") EndIf EndIf Wend Edited August 27, 2006 by Helge
McGod Posted August 27, 2006 Author Posted August 27, 2006 I'm a little bit unsure but I think this does what you want :#include <GUIConstants.au3> GUICreate("", 100, 40) $checkbox = GUICtrlCreateCheckbox ("No", 10, 10, 180, 20) GUISetState() While 1 $iMsg = GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Then ExitLoop If $iMsg = $checkbox Then If BitAND(GUICtrlRead($checkbox), $GUI_CHECKED) Then GUICtrlSetData($checkbox, "Yes") Else GUICtrlSetData($checkbox, "No") EndIf EndIf Wend Kinda. I arrayd all my inputs and checkboxes. So i dont know which ones are inputs and which ones are checkboxes My save func looks like Do $data[$i] = GUICtrlRead ( $S_GUI[$i] ) $name = GUICtrlRead ( $S_GUI[$i], 1) If $name = "CB" Then Select Case $data[$i] = $GUI_CHECKED $data[$i] = "Yes" Case $data[$i] = $GUI_UNCHECKED $data[$i] = "No" EndSelect EndIf $final = $final & "'" & $data[$i] & "', " $i = $i + 1 Until $i = UBound ( $S_GUI ) It will Get the data of control 0 then check if its a checkbox though the checkbox check part doesnt work. the $data will get saved with the code that wasnt posted. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
Helge Posted August 27, 2006 Posted August 27, 2006 The important part in my code is the use of BitAND, which you haven't used in yours. I'm extremely tired as it's very late here now, but you could try this code below which should work.. I think. Good night...eer, morning.Do $data[$i] = GUICtrlRead ( $S_GUI[$i] ) $name = GUICtrlRead ( $S_GUI[$i], 1) If $name = "CB" Then Select Case BitAND($data[$i], $GUI_CHECKED) $data[$i] = "Yes" Case BitAND($data[$i], $GUI_UNCHECKED) $data[$i] = "No" EndSelect EndIf $final = $final & "'" & $data[$i] & "', " $i = $i + 1 Until $i = UBound ( $S_GUI )
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