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 |
|
It works almost perfect. I was missing the IsAvailableInternal<> function, that helps a lot 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. Any ideas?
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Tue May 07 23:30:08 CEST 2024
Total time taken to generate the page: 0.03643 seconds
|