|
-
Apr 11th, 2004, 07:23 PM
#1
Thread Starter
Hyperactive Member
Tree View Help
I use this function to add nodes
VB Code:
Public Function AddTree(ByVal Name, ByVal Capt, ByVal PC)
Dim NodeC As Variant
Select Case PC
Case "P"
Set NN = TreeSetup.Nodes.Add(, , Name, Capt)
Case "C"
NodeC = NodeC & NodeC
Set NN = TreeSetup.Nodes.Add(Name, tvwChild, NodeC, Capt)
End Select
End Function
and i have these for my Nodes:
VB Code:
AddTree "Main", "Global", "P"
AddTree "Main1", "Battle.net", "P"
AddTree "Main1", "Login", "C"
AddTree "Main1", "Options", "C"
AddTree "Main2", "Bot Options", "P"
AddTree "Main2", "Anti-Idle", "C"
AddTree "Main2", "Filters", "C"
AddTree "Main2", "GUI", "C"
Code:
But it ends up Showing like
Global
[-]Battle.net
Login
Options
[+]Bot Options
Anti-Idle
Filters
GUI
But i want it Like
[-]Global
[+]Battle.Net
[-]Bot Options
Anti-Idle
Filters
GUI
I want to be able to Collapse Global, but it won't let me >_<!!!!
-
Apr 11th, 2004, 07:46 PM
#2
Your Main1 and Main2 nodes need to be Children of the Global node.
Why the function? It doesn't really do anything useful, you can just add the new nodes directly(unless you are not showing the entire code).
VB Code:
Private Sub Command1_Click()
AddTree "Main", "Global"
AddTree "Main1", "Battle.net", "Main"
AddTree "", "Login", "Main1"
AddTree "", "Options", "Main1"
AddTree "Main2", "Bot Options", "Main"
AddTree "", "Anti-Idle", "Main2"
AddTree "", "Filters", "Main2"
AddTree "", "GUI", "Main2"
End Sub
Public Function AddTree(ByVal Key As String, ByVal Caption As String, Optional ByVal ParentKey As String = "")
If ParentKey = "" Then
Set NN = TreeView1.Nodes.Add(, , Key, Caption)
Else
Set NN = TreeView1.Nodes.Add(ParentKey, tvwChild, Key, Caption)
End If
End Function
-
Apr 11th, 2004, 07:57 PM
#3
Thread Starter
Hyperactive Member
i have 2 more questions/favors to ask
How would i go about telling it to make a frame visibile when a certain node is Highlighted and not visibile when it's not highlighted?
-
Apr 11th, 2004, 08:21 PM
#4
VB Code:
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If TreeView1.SelectedItem.Key = "something" Then ' You could also use .Text
MyFrame.Visible = True
Else
MyFrame.Visible = False
End If
End Sub
-
Apr 11th, 2004, 10:15 PM
#5
The picture isn't missing
Right click your listview, click properties, and set LineStyle to Root Lines
Remember, if someone's post was not helpful, you can always rate their post negatively  .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|