Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [Drag and Drop] why are DragSourceEvent.{data, dataType} both null in dragFinished()?
[Drag and Drop] why are DragSourceEvent.{data, dataType} both null in dragFinished()? [message #465477] |
Wed, 14 December 2005 18:58 |
Paul E. Keyser Messages: 878 Registered: July 2009 |
Senior Member |
|
|
I have a Tree, with a DragSourceListener and a DropTargetListener, and I can drag and drop
(DROP_COPY) items within the tree, and everything works. Great!
Now I want to be able to have the user press some key (CTRL or SHIFT, maybe) and allow DROP_MOVE.
I've looked through this newsgroup, and repeatedly read both the articles:
http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml
http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html
So, from those articles I learn that, in the DragSourceListener#dragFinished() method, "If a move
operation has been performed, remove the data from the source" -- see
http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml#_ds29C ...
BUT when that method is called, both the event.data and the event.dataType are ALWAYS null. So how
am I supposed to tell what was dragged so as to be able to remove it? The example does not at all
answer the question, since it hardwires ONE drag source for all time -- not a very useable example,
for this question, since nearly all possible applications of a DragSourceListener will involve
multiple possible items as actual sources (e.g., in a Tree).
thanks,
Paul
|
|
|
Re: [Drag and Drop] why are DragSourceEvent.{data, dataType} both null in dragFinished()? [message #465544 is a reply to message #465477] |
Thu, 15 December 2005 01:11 |
Christopher Goy Messages: 38 Registered: July 2009 |
Member |
|
|
Did you look at the setData(DragSourceEvent event) method? You can set your
drag data there.
Hope this helps
Chris
"Paul Keyser" <rolarenfan@earthlink.net> wrote in message
news:dnpq0v$ok2$1@news.eclipse.org...
>I have a Tree, with a DragSourceListener and a DropTargetListener, and I
>can drag and drop (DROP_COPY) items within the tree, and everything works.
>Great!
>
> Now I want to be able to have the user press some key (CTRL or SHIFT,
> maybe) and allow DROP_MOVE. I've looked through this newsgroup, and
> repeatedly read both the articles:
>
> http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml
> http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html
>
> So, from those articles I learn that, in the
> DragSourceListener#dragFinished() method, "If a move operation has been
> performed, remove the data from the source" -- see
> http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml#_ds29C ...
>
> BUT when that method is called, both the event.data and the event.dataType
> are ALWAYS null. So how am I supposed to tell what was dragged so as to be
> able to remove it? The example does not at all answer the question, since
> it hardwires ONE drag source for all time -- not a very useable example,
> for this question, since nearly all possible applications of a
> DragSourceListener will involve multiple possible items as actual sources
> (e.g., in a Tree).
>
> thanks,
> Paul
|
|
| |
Goto Forum:
Current Time: Sun Dec 08 16:48:05 GMT 2024
Powered by FUDForum. Page generated in 0.03291 seconds
|