MrFlibble Posted February 14, 2008 Share Posted February 14, 2008 I have a script that reads a list of up to 40 computer numbers and displays them on the gui with corresponding checkboxes. The checkboxes are spaced 25 pixels apart going down the screen in line with the computer numbers. The labels are fine, but the checkboxes when it reaches about 15 down are only partially showing. Im assuming that the previous checkbox is partially covering the next checkbox, if you click on one of the checkboxes it shows in full and the top of the checkbox is quite a distance away from the bottom of the previous checkbox. Increasing the spacing isnt really much of an option, anybody have any ideas on either what Im doing wrong or a workaround for this? I know I havent explained very clearly so Ive included some code to show what I mean. #include <GUIConstants.au3> $gui = GUICreate("TEST",400,900) $button = GUICtrlCreateButton("Submit Username",120,7) $EditBoxUSer = GUICtrlCreateInput("Enter Username",10,10,100,20) GUISetState(@SW_SHOW) $string = "pc1,pc2,pc3,pc4,pc5,pc6,pc7,pc8,pc9,pc10,pc11,pc12,pc13,pc14,pc15,pc16,pc12,pc13,pc14,pc15,pc16, pc17,pc18,pc19,pc20,pc21,pc22,pc23,pc24,pc25" $aAllPc = StringSplit($string,",") Createcheckbox($aAllPc) ;;;;;;;;;;;;;;;;;;MAIN GUI LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While 1 $msg = GUIGetMsg(1) if $msg[0] = $GUI_EVENT_CLOSE Then Exit EndIf Wend Func Createcheckbox($aAllPc) $int = $aAllPc[0] + 1 Dim $pclabel[$int] , $chk[$int] $add = 50 $add1 = 50 For $i = 1 to UBound($aAllPc) - 1 $pclabel[$i] = GUICtrlCreateLabel($aAllPc[$i],5, $add1) $chk[$i] = GUICtrlCreateCheckbox("",100, $add) $add = $add + 25 $add1 = $add1 + 26 Next EndFunc Link to comment Share on other sites More sharing options...
weaponx Posted February 14, 2008 Share Posted February 14, 2008 You need the width and height values for your checkboxes. You can see the effect of this by adding a background color to the checkbox. #include <GUIConstants.au3> $gui = GUICreate("TEST",400,900) $button = GUICtrlCreateButton("Submit Username",120,7) $EditBoxUSer = GUICtrlCreateInput("Enter Username",10,10,100,20) GUISetState(@SW_SHOW) $string = "pc1,pc2,pc3,pc4,pc5,pc6,pc7,pc8,pc9,pc10,pc11,pc12,pc13,pc14,pc15,pc16,pc12,pc13,pc14,pc15,pc16,pc17,pc18,pc19,pc20,pc21,pc22,pc23,pc24,pc25" $aAllPc = StringSplit($string,",") Createcheckbox($aAllPc) ;;;;;;;;;;;;;;;;;;MAIN GUI LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While 1 $msg = GUIGetMsg(1) if $msg[0] = $GUI_EVENT_CLOSE Then Exit EndIf Wend Func Createcheckbox($aAllPc) $int = $aAllPc[0] + 1 Dim $pclabel[$int] , $chk[$int] $add = 50 $add1 = 50 For $i = 1 to UBound($aAllPc) - 1 $pclabel[$i] = GUICtrlCreateLabel($aAllPc[$i],5, $add1) $chk[$i] = GUICtrlCreateCheckbox("",100, $add, 20, 20) GuiCtrlSetBkColor(-1, 0xffffff) $add = $add + 25 $add1 = $add1 + 26 Next EndFunc Link to comment Share on other sites More sharing options...
MrFlibble Posted February 14, 2008 Author Share Posted February 14, 2008 You need the width and height values for your checkboxes. You can see the effect of this by adding a background color to the checkbox. #include <GUIConstants.au3> $gui = GUICreate("TEST",400,900) $button = GUICtrlCreateButton("Submit Username",120,7) $EditBoxUSer = GUICtrlCreateInput("Enter Username",10,10,100,20) GUISetState(@SW_SHOW) $string = "pc1,pc2,pc3,pc4,pc5,pc6,pc7,pc8,pc9,pc10,pc11,pc12,pc13,pc14,pc15,pc16,pc12,pc13,pc14,pc15,pc16,pc17,pc18,pc19,pc20,pc21,pc22,pc23,pc24,pc25" $aAllPc = StringSplit($string,",") Createcheckbox($aAllPc) ;;;;;;;;;;;;;;;;;;MAIN GUI LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While 1 $msg = GUIGetMsg(1) if $msg[0] = $GUI_EVENT_CLOSE Then Exit EndIf Wend Func Createcheckbox($aAllPc) $int = $aAllPc[0] + 1 Dim $pclabel[$int] , $chk[$int] $add = 50 $add1 = 50 For $i = 1 to UBound($aAllPc) - 1 $pclabel[$i] = GUICtrlCreateLabel($aAllPc[$i],5, $add1) $chk[$i] = GUICtrlCreateCheckbox("",100, $add, 20, 20) GuiCtrlSetBkColor(-1, 0xffffff) $add = $add + 25 $add1 = $add1 + 26 Next EndFunc Thanks very much :-) Link to comment Share on other sites More sharing options...
Monamo Posted February 14, 2008 Share Posted February 14, 2008 (edited) I have a script that reads a list of up to 40 computer numbers and displays them on the gui with corresponding checkboxes. The checkboxes are spaced 25 pixels apart going down the screen in line with the computer numbers. The labels are fine, but the checkboxes when it reaches about 15 down are only partially showing. I’m assuming that the previous checkbox is partially covering the next checkbox, if you click on one of the checkboxes it shows in full and the top of the checkbox is quite a distance away from the bottom of the previous checkbox. Increasing the spacing isn’t really much of an option, anybody have any ideas on either what I’m doing wrong or a workaround for this? I know I haven’t explained very clearly so I’ve included some code to show what I mean. #include <GUIConstants.au3> $gui = GUICreate("TEST",400,900) $button = GUICtrlCreateButton("Submit Username",120,7) $EditBoxUSer = GUICtrlCreateInput("Enter Username",10,10,100,20) GUISetState(@SW_SHOW) $string = "pc1,pc2,pc3,pc4,pc5,pc6,pc7,pc8,pc9,pc10,pc11,pc12,pc13,pc14,pc15,pc16,pc12,pc13,pc14,pc15,pc16, pc17,pc18,pc19,pc20,pc21,pc22,pc23,pc24,pc25" $aAllPc = StringSplit($string,",") Createcheckbox($aAllPc) ;;;;;;;;;;;;;;;;;;MAIN GUI LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While 1 $msg = GUIGetMsg(1) if $msg[0] = $GUI_EVENT_CLOSE Then Exit EndIf Wend Func Createcheckbox($aAllPc) $int = $aAllPc[0] + 1 Dim $pclabel[$int] , $chk[$int] $add = 50 $add1 = 50 For $i = 1 to UBound($aAllPc) - 1 $pclabel[$i] = GUICtrlCreateLabel($aAllPc[$i],5, $add1) $chk[$i] = GUICtrlCreateCheckbox("",100, $add) $add = $add + 25 $add1 = $add1 + 26 Next EndFunc It looks like it's just a matter of irregular spacing overlaps. Give this variation on your For... Next in the Createcheckbox() function a try - came up clean on a test run: For $i = 1 To UBound($aAllPc) - 1 $pclabel[$i] = GUICtrlCreateLabel($aAllPc[$i], 5, $add1,Default,20) $chk[$i] = GUICtrlCreateCheckbox("", 100, $add,Default,20) $add = $add + 25 $add1 = $add1 + 25 Next Edit: spacing Edit2: apparently I'm a slow typer - weaponx pointed it out for ya already Edited February 14, 2008 by Monamo - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
Squirrely1 Posted February 14, 2008 Share Posted February 14, 2008 (edited) You should alway check your GUI using the AutoIt Window Info tool: Start button > All Programs > AutoIt v3 > AutoIt Window Info With the tool open, you make your script's GUI active and hover your mouse over the checkboxes to find where they overlap each other, which they do! Edited February 14, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
MrFlibble Posted February 14, 2008 Author Share Posted February 14, 2008 You should alway check your GUI using the AutoIt Window Info tool:Start button > All Programs > AutoIt v3 > AutoIt Window InfoWith the tool open, you make your script's GUI active and hover your mouse over the checkboxes to find where they overlap each other, which they do!Good advice, its obviously something I've never done before. Anyone know why the size of the checkbox gets so much bigger as the list goes down? the Autoit Window Info tool really does highlight this. Link to comment Share on other sites More sharing options...
weaponx Posted February 14, 2008 Share Posted February 14, 2008 Good advice, its obviously something I've never done before. Anyone know why the size of the checkbox gets so much bigger as the list goes down? the Autoit Window Info tool really does highlight this.It pulls the height value out of its ass by default. Better just to specify. Link to comment Share on other sites More sharing options...
MrFlibble Posted February 14, 2008 Author Share Posted February 14, 2008 It pulls the height value out of its ass by default. Better just to specify.Lol, fair enough. Thanks all for help and advice. Link to comment Share on other sites More sharing options...
weaponx Posted February 14, 2008 Share Posted February 14, 2008 After some investigation, the height of each checkbox was always (ControlID + 8) pixels for me...sounds like some kind of conspiracy. 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