How to detect if the user is dragging nodes from another virtual treeview?

139 views Asked by At

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

1

There are 1 answers

1
fpiette On BEST ANSWER

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);