Dumdidum
asked on
Several Treeview-Questions...
Hello
I am using the Treeview-Control for my first time and I have some questions...
I have now the following Treeview:
http://www.ruttensoft.com/file/treeview.jpg
The questions:
1. How can I select "Name von eigenem Projekt" without using the mouse?
2. How can I make a new Item at "My Company"? (at the selected item)?
3. How can I rename the selected item in the treeview itself?
4. How can I delete the selected item?
Thanks a lot in advance
Sven
I am using the Treeview-Control for my first time and I have some questions...
I have now the following Treeview:
http://www.ruttensoft.com/file/treeview.jpg
The questions:
1. How can I select "Name von eigenem Projekt" without using the mouse?
2. How can I make a new Item at "My Company"? (at the selected item)?
3. How can I rename the selected item in the treeview itself?
4. How can I delete the selected item?
Thanks a lot in advance
Sven
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry, that last code line was supposed to read:
Z = RemoveSelectedNode() ' where Z is declared as a boolean
Z = RemoveSelectedNode() ' where Z is declared as a boolean
ASKER
Hi
Thanks, is it possible to rename the selected note directy in the treeview?
Like this:
http://www.ruttensoft.com/file/tree.jpg
Thanks
Sven
Thanks, is it possible to rename the selected note directy in the treeview?
Like this:
http://www.ruttensoft.com/file/tree.jpg
Thanks
Sven
Not sure I understand you... to edit a label/node like that, you set LabelEdit (property of treeview) to true... select the node you want to edit, then click on it once.
... if you want to start the label edit through code:
Function EditSelectedNode() As Boolean
If TreeView1.SelectedNode Is Nothing Then
Return False
Else
TreeView1.SelectedNode.Beg inEdit()
Return True
End If
End Function
NOTE: Make sure the TreeView's LabelEdit property is set to true before you try to use the above
... if you want to start the label edit through code:
Function EditSelectedNode() As Boolean
If TreeView1.SelectedNode Is Nothing Then
Return False
Else
TreeView1.SelectedNode.Beg
Return True
End If
End Function
NOTE: Make sure the TreeView's LabelEdit property is set to true before you try to use the above
ASKER
Thanks, one last question:
Is it possible to copy one treeview to another?
Thanks
Sven
Is it possible to copy one treeview to another?
Thanks
Sven
Not really... you can't add an existing node into another treeview control (if you try it, you'll get an error).
I think you'd have to go through all the nodes making clones (or copies with the same properties so you're not actually using that node) of them.
I could be wrong tho.
I think you'd have to go through all the nodes making clones (or copies with the same properties so you're not actually using that node) of them.
I could be wrong tho.
X = AddToSelectedNode("BLAH BLAH") ' where X is declared as a treenode
If a node is selected, a node with text "BLAH BLAH" is added, and a reference to that new node is returned
If no node is selected, then Nothing is returned
If you don't need a reference to the newly added node, remove the "X = " from the code line
Y = RenameSelectedNode("BLAH BLAH") ' where Y is declared as a boolean
If a node is selected, it's text is changed to "BLAH BLAH".. and True is returned to express a success
If no node is selected, then False is returned to express failure
If you don't need to know whether it was a success or not, remove the "Y = "
Z = RenameSelectedNode() ' where Z is declared as a boolean
If a node is selected, it is removed (including it's child nodes).. and True is returned to express a success
If no node is selected, then False is returned to express failure
If you don't need to know whether it was a success or not, remove the "Z = "