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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview refresh - stay on current node

Status
Not open for further replies.

UHNSTrust

Technical User
Dec 2, 2003
262
0
0
GB
I have managed to populate my treeview control. What I now want to do is to add a record in the underlying table, refresh/reload the treeview control (to show the added record) and then return to the same node that I was on prior to adding the new record.

I can do the refresh and reload on the treeview control. However I am lost as to how to return to the right node. I have the node.key recorded. Can somebody point me how to return to the node?

Thanks in advance.

Jonathan
 
Whilst I think of it, is there any way to stop the users editing the text in the nodes? When they click on the node for a second time it goes into edit.

Thanks
Jonathan
 
save the key of the node in a public variable "strSavedKey" (global if you close out the form). Then something like


dim objTree as treeview
set objTree = me.tvwTree.object
objTree.nodes(strSavedKey).selected = true
 
By default, the Text property of each node can be edited by the user simply by clicking on the caption of the selected node. In this case, the LabelEdit property is set to 0-tvwAutomatic. When set to 1-tvwManual, the caption can be edited by the user only after the StartLabelEdit method is called.
 
Thanks for the reply MajP. Works great.

Jonathan
 
Another question: When you choose a node it is highlighted. If you then take the focus off the treeview object to another control the highlight does not show. Is there any way to keep the node highlighted once the treeview control does not have the focus?

Jonathan
 
Not as far as I know. You could change the font bold, change the color, add a check, add an icon to the selected node. Or something else to show it, but I doubt you could hilite when it does not have focus.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top