Autoscroll during Drag&Drop? [message #1421473] |
Thu, 11 September 2014 08:16  |
Eclipse User |
|
|
|
Hi,
I have a NatTable with a number of items such that a vertical scroll bar gets displayed.
I've implemented Drag & Drop of table items inside of the NatTable; it is working well as long I am dragging inside of the visible area only; yet, I can't get the table to autoscroll when I drag an item over the lower bound of it.
According to the documentation of DropTargetAdapter, this should be achieved by setting event.feedback to DND.FEEDBACK_SCROLL in the dragOver() method; however, this does not seem to have any effect on the NatTable.
What is the correct way to achieve autoscrolling here?
|
|
|
|
|
|
Re: Autoscroll during Drag&Drop? [message #1422351 is a reply to message #1421597] |
Fri, 12 September 2014 14:30  |
Eclipse User |
|
|
|
Quote:I've implemented Drag & Drop of table items inside of the NatTable
I missed one detail in your question ... you are dragging INSIDE NatTable, not trying to drag and drop things from the outside into a NatTable.
In that case you shouldn't use SWT Drag&Drop implementations. When operating inside NatTable you should implement and register a IDragMode like the ColumnReorderDragMode or the RowReorderDragMode that executes a ViewportDragCommand on move.
But notice that in such cases the autoscroll only works if the mouse cursor hovers on the edge, still inside the NatTable. If you are moving the mouse cursor outside the NatTable area, we do not get any further events.
Maybe you could create and register a new IDragMode that enables dragging of items in NatTable. And to add the possibility to autoscroll when moving out of the NatTable area you would need to create and register an action on mouseExit that checks if the item dragging is currently active, and if so start scrolling. Of course you would need another action on mouseEnter that stops autoscrolling.
Although this would be of course nice to have in NatTable core, I think it is possible to achieve without modifying NatTable code. So I'm still curious on your contribution, but I will not wait for it to bring out the upcoming bugfix release people are waiting for.
|
|
|
Powered by
FUDForum. Page generated in 0.25467 seconds