I want to drag and drop TreeViewItems that have custom components. Since my tree may be very large, I want an auto-scroll feature. I implemented this with a Timer that repeatedly calls setViewPosition on the Viewport of the TreeView.
The problem is the following one: scrolling in the tree may delete the component being dragged (as soon as it’s source position becomes invisible). DragImageComponent then detects the Components’ deletion and drag and drop is aborted (without any callback being called).
In order to fix this problem, I tried to clone the TreeViewItem’s component before passing it to startDragging(). This still leads to strange results and it is not trivial how to delete this cloned component once dragging is finished.
Any idea for a better solution ? Should this not be handled by TreeView internally ?
Thanks for your help,