Sign in to follow this  
Followers 0
Lmac34

Help with Dynamic TreeViewItem Traversal

3 posts in this topic

#1 ·  Posted (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 by Lmac34

Share this post


Link to post
Share on other sites



A method that kinda works can be found here you will have to update the line

local $hWnd = ControlGetHandle("TREEVIEW TEST","","SysTreeView32")

for this one

local $hWnd = GUICtrlGetHandle($TreeView1)

Like what Danny35d explained.

http://www.autoitscript.com/forum/index.php?showtopic=48757

regards

Lmac34

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0