Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Moving elements in a custom widget
Moving elements in a custom widget [message #1234573] Wed, 22 January 2014 09:41
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member

I created a custom widget which extends the Draw2D FigureCanvas. This custom widget is displaying columns next to each other, each column containing some additional figures (not really relevant here).

What I would like is to have the ability to change the column order by pressing the mouse button on a column heading, dragging it to the new position and releasing the mouse button (similar as a drag and drop operation). The widget should show visual feedback during that operation, for instance a green line at the new column position (shown between two columns). The cursor should also be changed to the default drag and drop cursor (display the drop move cursor or drop none cursor if the column cannot be moved to the target position).

Now I'm wondering what would be the best way to handle this. I already tried with the SWT drag and drop but it feels complex to implement it this way (I only need to move columns inside the widget, doesn't make any sense to drop a column outside of the widget).
I could also listen for mouse events (mouse down, mouse up, ...) but I have no clue how to modify the mouse cursor with that approach.

What would be the best approach to handle this problem ? Via DnD or by handling the SWT mouse events directly in the widget ?
Previous Topic:MasterDetailsBlock how to resize the sash programmatically
Next Topic:How to manipulate scrolling behavior?
Goto Forum:

Current Time: Mon Jun 18 07:44:56 GMT 2018

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

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

Back to the top