Lmac34 Posted June 26, 2007 Posted June 26, 2007 (edited) HI All Im having some trouble with These TreeViews First time trying them out, and I have searched the forum for all treeview related topics but cannot find a suitable answer. Im creating the TreeViewitems Dynamically and what I want to do is to make sure that the same item is not entered twice. I have no problem creating the TreeView, its the Traversing the TreeView Dynamically (without the user clicking on a treeviewitem) is where I am falling flat on my face. I have tried a number of different ways most using the _GUICtrlTreeViewGetText() Function put all I ever seem to get is the First PARENT ITEM in THE TREE. Can anyone help? Regards Lmac Func NewJob() Local $selected = GUICtrlRead($mylist2);GET SELECTED ELEMENT FROM LIST local $i =0 Local $found = 0; For $i = 0 to $numberofJobs Step 1 ;CODE TO SEARCH EACH PARENT TREEVIEWITEM IF($selected = $iteminTreeview) Then;CHECK TO SEE IF ELEMENT IS IN TREEVIEW $found = 1 EndIf Next If $found <> 1 Then ;NOT IN TREEVIEW ADD IT Assign("Job"&$numberofJobs,GUICtrlCreateTreeViewitem($selected, $IMGTORUN),2);CREATE PARENT Assign("Job"&$numberofJobs&"Sub1",GUICtrlCreateTreeViewitem("Store Local Logs: "&$RTLogs, "Job"&$numberofJobs),2);CREATE 5 SUB ITEMS TO PARENT Assign("Job"&$numberofJobs&"Sub2",GUICtrlCreateTreeViewitem("Store Remote Logs: "&$RemoteRT, "Job"&$numberofJobs),2) Assign("Job"&$numberofJobs&"Sub3",GUICtrlCreateTreeViewitem("Store Customers Logs: "&$RTCust, "Job"&$numberofJobs),2) Assign("Job"&$numberofJobs&"Sub4",GUICtrlCreateTreeViewitem("Project Directory: "&$Project, "Job"&$numberofJobs),2) Assign("Job"&$numberofJobs&"Sub5",GUICtrlCreateTreeViewitem("IMAGE Base Location: "&$windiffloc, "Job"&$numberofJobs),2) $numberofJobs = $numberofJobs + 1 EndIf EndFunc Edited June 26, 2007 by Lmac34
Zedna Posted June 26, 2007 Posted June 26, 2007 Look at Auto3LibThere are nice functions for TreeView control also with demo examples.For example: _TreeView_FindNode() Resources UDF ResourcesEx UDF AutoIt Forum Search
Lmac34 Posted July 3, 2007 Author Posted July 3, 2007 A method that kinda works can be found here you will have to update the line local $hWnd = ControlGetHandle("TREEVIEW TEST","","SysTreeView32")for this onelocal $hWnd = GUICtrlGetHandle($TreeView1)Like what Danny35d explained.http://www.autoitscript.com/forum/index.php?showtopic=48757regards Lmac34
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