|Moving elements in a custom widget [message #1234573]
||Wed, 22 January 2014 04:41
| Cedric Moonen
Registered: August 2009
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 ?
Powered by FUDForum
. Page generated in 0.01487 seconds