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 » Restrict drag&drop to one level
Re: Restrict drag&drop to one level [message #26115 is a reply to message #26101] Thu, 01 April 2010 23:59 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

It works almost perfect. I was missing the IsAvailableInternal<> function, that helps a lot Smile But few problems still remain:

First, as I am using MultiSelect(), the level restriction fails when multiple levels are in selection. I solved this by adding following function as WhenSel callback:
void CheckSel(){
		Vector<int> sel=tree.GetSel();
		int last=sel.GetCount()-1;
		if (last<1) return;
		if (GetLevel(sel[0])!=GetLevel(sel[last]))
			tree.SelectOne(sel[last],false);
	}

It is not perfect solution, but works reasonably with minimal effort.

Another problem is, that if you drag data item to root (or anywhere below the tree), it disappears on drop. I think it is because it just slips through the restriction rules without triggering any of them, but I couldn't find how to prevent that. Confused Any ideas?

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Distorted GUI / memory leak
Next Topic: Suppress drawing the root 0 node
Goto Forum:
  


Current Time: Tue May 07 23:30:08 CEST 2024

Total time taken to generate the page: 0.03643 seconds