Drag & Drop table - dragging items down past window too slow [message #778250] |
Wed, 11 January 2012 18:39  |
Eclipse User |
|
|
|
I have a DND table, populated with a bunch of items and sometimes the list gets pretty long.
My problem is that when I try to drag an item down the list, once I get to the bottom of the window and it needs to start scrolling, it goes pretty slow. Since this list is sometimes quite long, I really need to be able to drag all the way down to the bottom much faster.
How would I accomplish this? Is there anyway to set the scroll speed depending on how long the list is?
I currently have this DND table wrapped in a ScrolledComposite, which did seem to help functionality a bit, but its still way to slow, and using ScrollBar and setting increment didn't seem to do anything either.
Any ideas?
|
|
|
|
Re: Drag & Drop table - dragging items down past window too slow [message #779981 is a reply to message #778747] |
Mon, 16 January 2012 18:50  |
Eclipse User |
|
|
|
In case anyone else finds this in search with the same problem, I'll write down the solution that I came up with.
What I did was wait for the DND table to enter the dragEnter method, at which point I used the getBounds() method of the table.
Then I grabbed all the parent containers outwards from the table and got their boundaries as well until I got to the SWT shell, and got its boundary as well.
Now that I have the exact boundary of the table in relation to the desktop, I just used the java.awt.MouseInfo class to get my current coordinates and whenever my mouse dragged to the top or bottom of the table, i would repeatadly update table.setSelection() incrementally until i got to the end of the list or the mouse moved away from the top or bottom of the table. (or release drag)
Works great.
|
|
|
Powered by
FUDForum. Page generated in 0.04479 seconds