VitrtualStringTree. How to Drag'n'Drop to ROOT level?

Posted by Alexandr on Stack Overflow See other posts from Stack Overflow or by Alexandr
Published on 2013-11-09T06:35:07Z Indexed on 2013/11/09 9:54 UTC
Read the original article Hit count: 230

A have a tree: ROOT - VirtualStringTree(You don't see it, TVirtualStringTree.RootNode)

 - My Root Node 1
 - My Root Node 2
 - - Second node 1
 - - Second node 2
 - - Second node 3
 - My Root Node 3

I can Drag'n'Drop "My Root Node 3" to any visible node, but I can't return it to defaut position, to the root level of tree.

I try that:

//Part of code from OnDragDrop Event of VirtualStringTree
    if (Sender.DropTargetNode = Sender.RootNode) then
    begin
      for i := 0 to high(Nodes) do
      begin
        LinksTree.MoveTo(Nodes[i], Sender.DropTargetNode, Attachmode, False);
      end;
    end;

I places mouse to nowhere, but nothing happens. In DragOver I accepted drop to root if DropTarget is VST.RootNode.

Anybody knows, how to drop node to VST.RootNode if I drag mouse to empty space of component?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about treeview