1
votes

I am using a TreeViewer for displaying my tree. I would like to offer the opportunity to sort nodes by hand by letting the user drag a node and let him drop it at the new location.

I am looking for a possiblity for determining between which nodes the node was dropped or whether it was drop at the control-border and the first node. Is there any suggest or usual way for detecting the drop location relative to the other nodes(before/after)?

My idea was to get the Point of the drop look whichh node is there an whether the point is in the upper or lower half of the items-boundary (sounds easy, but is sure painfully to implement). I would appreciate any other possibility...

1
Could you post your code and indicate where the pain is? :) - Martti Käärik
I have no code yet, just the idea of having to do it like described above causes me pain ;-). So that is the usual way to do it? Do you know some example implementation? Can't believe I am the first one needing this feature? - user1091534

1 Answers

2
votes

Detecting the item based on cursor location is pretty much the only way and you probably need to do this also during dragOver(). Here's an example.