Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TreeCtrl » Drag and Drop for TreeCtrl
Re: Drag and Drop for TreeCtrl [message #9284 is a reply to message #9269] Wed, 25 April 2007 17:39 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Some code to deal with the children:
void MoveChildren(int src, int dest)
{
	while (GetChildCount(src)) {
		int child = GetChild(src, 0);
		TreeCtrl::Node node;
		
		node = GetNode(child);
		MoveChildren(child, Add(dest, node));
		Remove(child);
	}
}

And use it like so (removal of source node must happen after addition of destination - for obvious reasons):
    // add id to idTarget and remove id
    TreeCtrl::Node node = GetNode(id);	
    MoveChildren(id, this->Add(idTarget,node));		
    this->Remove(id);
    this->Open(idTarget);	


I've got a version of this that doesn't need a RectTracker or a custom Option control that I'll post if you're interested.

James

[Updated on: Wed, 25 April 2007 17:43]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: TreeCtrl - DeepClose not works
Next Topic: Serialize
Goto Forum:
  


Current Time: Mon Jul 07 12:59:23 CEST 2025

Total time taken to generate the page: 0.03543 seconds