Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Drag & Drop table - dragging items down past window too slow(any way to speed up the scrolling down speed while dragging an item???)
Drag & Drop table - dragging items down past window too slow [message #778250] Wed, 11 January 2012 23:39 Go to next message
r r is currently offline r r
Messages: 3
Registered: January 2012
Junior Member
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 #778747 is a reply to message #778250] Fri, 13 January 2012 18:53 Go to previous messageGo to next message
r r is currently offline r r
Messages: 3
Registered: January 2012
Junior Member
I could probably get it to work if I could get a selectionListener working on the vertical scroll bar on the table.

But currently that only works if the user clicks the actual scrollbar, but doesn't register when the scroll bar auto-scrolls.

Is there any way to listen for when the scrollbar moves automatically while dragging?
Re: Drag & Drop table - dragging items down past window too slow [message #779981 is a reply to message #778747] Mon, 16 January 2012 23:50 Go to previous message
r r is currently offline r r
Messages: 3
Registered: January 2012
Junior Member
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.
Previous Topic:Del-accelerator conflicts with del-"action" in text field
Next Topic:log4j appender for SWT Text
Goto Forum:
  


Current Time: Thu Oct 23 13:10:31 GMT 2014

Powered by FUDForum. Page generated in 0.02676 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software