trillion Posted November 8, 2007 Share Posted November 8, 2007 I hope someone can help me , i am trying to make multiple checkbox selection at the treeview and to display the selected information in text at the description area. below are the following coding. #include <GUIConstants.au3> #include <GuiEdit.au3> while 1 GUICreate("cat duty System",1273,745,1,1,BitOr($WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_GROUP,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU)) $maintree = GUICtrlCreateTreeView (10,10,300,700) $aboutitem = GUICtrlCreateTreeViewItem ("About",$maintree) $location1item = GUICtrlCreateTreeViewItem ("location1",$maintree) $location2item = GUICtrlCreateTreeViewItem ("location2",$maintree) $location3item = GUICtrlCreateTreeViewItem ("location3",$maintree) $cat1item = GUICtrlCreateTreeViewItem ("cat",$location1item) $cat2item = GUICtrlCreateTreeViewItem ("cat",$location2item) $cat3item = GUICtrlCreateTreeViewItem ("cat",$location3item) $descgroup = GUICtrlCreateGroup ("Description",350,400,900,300) GUICtrlSetState (-1,$GUI_HIDE) $cat1sgroup = GUICtrlCreateGroup ("cat",350,10,900,350) GUICtrlSetState (-1,$GUI_HIDE) $cat1stree = GUICtrlCreateTreeView (360,30,880,320,BitOr($TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE) GUICtrlSetState (-1,$GUI_HIDE) $cat1 = GUICtrlCreateTreeViewItem ("cat 1",$cat1stree) $cat2 = GUICtrlCreateTreeViewItem ("cat 2",$cat1stree) $cat3 = GUICtrlCreateTreeViewItem ("cat 3",$cat1stree) $cat4 = GUICtrlCreateTreeViewItem ("cat 4",$cat1stree) $cat5 = GUICtrlCreateTreeViewItem ("cat 5",$cat1stree) $cat2sgroup = GUICtrlCreateGroup ("cat",350,10,900,350) GUICtrlSetState (-1,$GUI_HIDE) $cat2stree = GUICtrlCreateTreeView (360,30,880,320,BitOr($TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE) GUICtrlSetState (-1,$GUI_HIDE) $cat6 = GUICtrlCreateTreeViewItem ("cat 1",$cat2stree) $cat7 = GUICtrlCreateTreeViewItem ("cat 2",$cat2stree) $cat8 = GUICtrlCreateTreeViewItem ("cat 3",$cat2stree) $cat9 = GUICtrlCreateTreeViewItem ("cat 4",$cat2stree) $cat10 = GUICtrlCreateTreeViewItem ("cat 5",$cat2stree) $cat3sgroup = GUICtrlCreateGroup ("cat",350,10,900,350) GUICtrlSetState (-1,$GUI_HIDE) $cat3stree = GUICtrlCreateTreeView (360,30,880,320,BitOr($TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE) GUICtrlSetState (-1,$GUI_HIDE) $cat11 = GUICtrlCreateTreeViewItem ("cat 1",$cat3stree) $cat12 = GUICtrlCreateTreeViewItem ("cat 2",$cat3stree) $cat13 = GUICtrlCreateTreeViewItem ("cat 3",$cat3stree) $cat14 = GUICtrlCreateTreeViewItem ("cat 4",$cat3stree) $cat15 = GUICtrlCreateTreeViewItem ("cat 5",$cat3stree) $aboutlabel = GUICtrlCreateLabel ("cat duty System",650,400,160,20) $cancelbutton = GUICtrlCreateButton ("Cancel",600,710,70,20) GUISetState() GUIctrlSetState ($cat11,$GUI_CHECKED) GUIctrlSetState ($cat10,$GUI_CHECKED) GUIctrlSetState ($cat12,$GUI_CHECKED) GUIctrlSetState ($cat15,$GUI_CHECKED) While 1 $msg = GUIGetMsg() Select Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton ExitLoop Case $msg = $cat1item ;label start opt('MustDeclareVars', 1) Dim $myedit, $msg, $Btn_Scrollv, $Btn_Scrollh $myedit = GUICtrlCreateEdit("Alibaba, white , black" & @CRLF, 360, 430, 870, 250, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL)) GUICtrlSetLimit($myedit, 1500) dim $blah $blah = GUICtrlRead($cat1) If $blah = $GUI_CHECKED Then MsgBox(0,'','$check is checked') ElseIf $blah = $GUI_UNCHECKED Then GUICtrlSetData($myedit, "123", 1) EndIf ; will be append dont' forget 3rd parameterGUISetState() ; Run the GUI until the dialog is closed $msg = GUIGetMsg() $msg = $Btn_Scrollv _GUICtrlEditLineScroll ($myedit, 0, 1) $msg = $Btn_Scrollh _GUICtrlEditLineScroll ($myedit, 10, 0) ;label end GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($cat1sgroup,$GUI_SHOW) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlSetState($cat1stree,$GUI_SHOW) GUICtrlSetBkColor ($cat1stree,0xD0F0F0) ;GUIctrlSetState...($cat1stree,$GUI_SHOW) Case $msg = $cat2item GUIctrlSetState ($cat1stree,$GUI_HIDE) GUIctrlSetState ($cat1sgroup,$GUI_HIDE) GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($cat2sgroup,$GUI_SHOW) GUIctrlSetState ($descgroup,$GUI_SHOW) ;GUIctrlSetState.($cat2stree,$GUI_SHOW) GUICtrlSetState ($cat2stree,$GUI_SHOW) GUICtrlSetColor ($cat2stree,0xD00000) GUICtrlSetBkColor ($cat2stree,0xD0FFD0) ;label start opt('MustDeclareVars', 1) Dim $myedit, $msg, $Btn_Scrollv, $Btn_Scrollh $myedit = GUICtrlCreateEdit("abcd" & @CRLF, 360, 430, 870, 250, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL)) $myedit = GUICtrlCreateEdit("abcd" & @CRLF, 360, 430, 870, 250, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL)) GUICtrlSetLimit($myedit, 1500) ; will be append dont' forget 3rd parameter GUICtrlSetData($myedit, "It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF & _ "in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript" & @CRLF & _ "and SendKeys)." & @CRLF & _ 'AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the' & @CRLF & _ "arrival of v3 it is also well suited to performing home automation and the scripting of repetitive" & @CRLF & _ "tasks." & @CRLF & @CRLF & "AutoIt can:" & @CRLF & @CRLF & "Execute Windows and DOS executables", 1) GUISetState() ; Run the GUI until the dialog is closed $msg = GUIGetMsg() $msg = $Btn_Scrollv _GUICtrlEditLineScroll ($myedit, 0, 1) $msg = $Btn_Scrollh _GUICtrlEditLineScroll ($myedit, 10, 0) ;label end Case $msg = $cat3item GUIctrlSetState ($aboutlabel,$GUI_HIDE) GUIctrlSetState ($cat1sgroup,$GUI_SHOW) GUIctrlSetState ($descgroup,$GUI_SHOW) GUICtrlSetState($cat3stree,$GUI_SHOW) GUICtrlSetBkColor ($cat3stree,0xD0F0F0) ;GUIctrlSetState...($cat3stree,$GUI_SHOW) ;label start opt('MustDeclareVars', 1) Dim $myedit, $msg, $Btn_Scrollv, $Btn_Scrollh $myedit = GUICtrlCreateEdit("12345" & @CRLF, 360, 430, 870, 250, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL)) GUICtrlSetLimit($myedit, 1500) ; will be append dont' forget 3rd parameter GUICtrlSetData($myedit, "It uses a combination of simulated keystrokes, mouse movement and window/control manipulation" & @CRLF & _ "in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript" & @CRLF & _ "and SendKeys)." & @CRLF & _ 'AutoIt was initially designed for PC "roll out" situations to configure thousands of PCs, but with the' & @CRLF & _ "arrival of v3 it is also well suited to performing home automation and the scripting of repetitive" & @CRLF & _ "tasks." & @CRLF & @CRLF & "AutoIt can:" & @CRLF & @CRLF & "Execute Windows and DOS executables", 1) GUISetState() ; Run the GUI until the dialog is closed $msg = GUIGetMsg() $msg = $Btn_Scrollv _GUICtrlEditLineScroll ($myedit, 0, 1) $msg = $Btn_Scrollh _GUICtrlEditLineScroll ($myedit, 10, 0) ;label end EndSelect wend GUIDelete() WEnd Exit Link to comment Share on other sites More sharing options...
Zedna Posted November 11, 2007 Share Posted November 11, 2007 (edited) Look hereespecially at treeview_item_state_example.au3 Edited November 11, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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