Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrollable trees

Status
Not open for further replies.

Goha

IS-IT--Management
May 9, 2002
91
0
0
US
I am having trouble with the following:
1. How do I put a tree structure which lists a series of reports on to a scrollable area. the items in the tree are large enough to require it to be scrollable.
2. How do I add icons to each individual tree node?

Please provide sample code.

Thanks in advance
 
Code to add items to tree view:

Dim node1 as Node

Set Node1 = TreeView1.Nodes.add(,,"P1","Parent1")
Set Node1 =TreeView1.Nodes.add("P1",tvwChild,"CA1","Child1")
Set Node1 =TreeView1.Nodes.add("P1",tvwChild,"CA2","Child2")

Set Node1 = TreeView1.Nodes.add(,,"P2","Parent2")
Set Node1 =TreeView1.Nodes.add("P2",tvwChild,"CB1","Child1")
Set Node1 =TreeView1.Nodes.add("P2",tvwChild,"CB2","Child2")

Parent represents the report name and child would represent the subreport or related report - depends on what you want your heirarchy to look like. The tree view automatically become scrollable once you have items in there that are larger than the tree - you can always adjust the tree view size(make it smaller) to test out the scroll bar.

If your report names are coming in via an array then you would have to find a way to distinguish the parent and child nodes - once you do that (perhaps add a colum for each row of data that states if its a parent or child - if each node is a parent then this is a nonissue) then just loop thru each item in the array and using the code above, add each item to the tree.

To associate an icon for each node in a tree view you can check out this url:
-its pretty straight forward and there is sample code provided.

Hope this helps.
-A
 
I am still having trouble with the Icons part.

I also have another question regarding treeviews.
1) how do i refer to the treeview node's description when I double click it?
2)after i create my treeview how do i add the number of children to a particular node here is an example....

before
------
root
parent1
child1
child2
child3
parent2
child4
child5
child6
child7

after
------
root (2/7)
parent1 (3)
child1
child2
child3
parent2 (4)
child4
child5
child6
child7

Thanks in advance....

[pc]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top