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

TreeView Control Updating

Status
Not open for further replies.

Effection

Programmer
Dec 9, 2007
1
GB
In my form i have a TreeView control that holds a large number of nodes. When i want to update this contol i have to clear all the nodes and refresh it with the new ones but my problem is that it does not reopen the last selected node. I have tried (before updating) storing the Selected node in a temp node variable, then after update doing this, tv_database->SelectedNode = selectedno;

but this either cause an exception when no node was selected or it doesnt affect the current selected node at all.

The only method of updating the treeview i have found is by performing these few lines:
//Remove all current nodes
database->Nodes->Clear();
tv_database->BeginUpdate();
//Add Some nodes...
tv_database->Nodes->Add(newnode);
//End the update
tv_database->EndUpdate();

is there any method that only updates the text on the nodes, doing something like
tv_database->->SelectedNode->Text = "new text"; wont update the text as the conrol isnt re-drawn, is there anymethod of doing this so as not to clear all the current nodes and just updating the text on them all?

sorry if i have explained this badly :(
 
Is there a "SetText" method on the Node class?
Can you invalidate the window the tree is drawn in?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top