3

In the OnDragOver or OnDragDrop events, how to check if the user is dragging nodes of the same Virtual Treeview or of another?

DragType is dtVCL

Edwin Yip
  • 4,089
  • 4
  • 40
  • 86

1 Answers1

4

In both events, you have arguments Sender and Source. Sender is the component sending the event, that is the tree above which the mouse is flying, the drag receiver. The Source is the tree from which the drag is coming.

You can cast the Sender or Source to the actual tree you use.

Memo1.Lines.Add(TVirtualStringTree(Sender).Name);
Memo1.Lines.Add(TVirtualStringTree(Source).Name);
fpiette
  • 11,983
  • 1
  • 24
  • 46
  • I didn't know why I tried several other indirect, failed approaches and perfectly missed the `Source` parameter... Thank you very much! – Edwin Yip Sep 13 '20 at 22:45