ajit Posted September 27, 2009 Share Posted September 27, 2009 Hi: I need multiple checkboxes in two columns. With Guictrlcreatelistview I can get only one column with checkboxes. Is there any other method where I can get two columns of checkboxes in my GUI so that i can scroll down to click them. Having a scrolable GUI also does not solve the problem since other controls also move along. Can someone guide me how to go about it? Thanking in anticipation Ajit Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 27, 2009 Moderators Share Posted September 27, 2009 ajit, Perhaps something along these lines (based on the examples in the Help file)? expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> #include <GUIScrollBars.au3> #include <ScrollBarConstants.au3> Opt("MustDeclareVars", 1) _Main() Func _Main() Local $nFileMenu, $nExititem, $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2 Local $listview, $button $hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1) $nFileMenu = GUICtrlCreateMenu("File") $nExititem = GUICtrlCreateMenuItem("Exit", $nFileMenu) GUICtrlCreateButton("Test", 300, 10, 80, 30) $h_cGUI = GUICreate("Child GUI", 200, 260, 10, 10, $WS_CHILD, Default, $hGUI) For $i = 0 to 39 Step 2 GUICtrlCreateCheckbox("Check " & $i + 1, 10, 10 + 20 * $i/2, 90, 20) GUICtrlCreateCheckbox("Check " & $i + 2, 110, 10 + 20 * $i/2, 90, 20) Next GUISetState() GUICtrlSetResizing($h_cGUI, $GUI_DOCKALL) GUISwitch($hGUI) GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") GUISetState() _GUIScrollBars_Init($h_cGUI) _GUIScrollBars_ShowScrollBar($h_cGUI, $SB_HORZ, False) _GUIScrollBars_SetScrollInfoMax($h_cGUI, $SB_VERT, 25) While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE, $nExititem ExitLoop EndSwitch WEnd Exit EndFunc ;==>_Main Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos For $x = 0 To UBound($aSB_WindowInfo) - 1 If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $yChar = $aSB_WindowInfo[$index][3] ExitLoop EndIf Next If $index = -1 Then Return 0 ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments ;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ;// If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos)) $yPos = $Pos EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ajit Posted September 27, 2009 Author Share Posted September 27, 2009 @Melba23 Thanks a lot for your help. That should solve my problem of multiple checkboxes. Thanks again Ajit Link to comment Share on other sites More sharing options...
FreeBeing Posted January 13, 2010 Share Posted January 13, 2010 Thank you very much, that script help me really 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