Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Drag And Drop Best practice ?
Drag And Drop Best practice ? [message #452091] Mon, 14 March 2005 14:43 Go to next message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 96
Registered: July 2009
Member
Hi,

I use a Tree viewer as a Drag source and a Composite as a Drop target.
Users can so drag and drop tree nodes content.

I'm now asked to modify this by creating a new Composite (in a new Shell)
if the user drops the tree node outside the existing drop target.

So I have now one drag source and two distinct drop targets.

To determine whether the drop has been done on the dedicated Composite or
outside, I read the event.detail content in the dragFinished method, if it
is equal to DND.DROP_NONE, the drop has been done outside the Composite.

Is it a good way to do this ???

Thanks
Helene
Re: Drag And Drop Best practice ? [message #452203 is a reply to message #452091] Tue, 15 March 2005 12:47 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
The DND.DROP_NONE value is set if the user drops the data anywhere that will
not accept it - for example another application, the desktop, etc. You
must handle the DND.DROP_NONE to mean the data was not dropped on a valid
target.

For more information about Drag and Drop see:

http://eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html

http://eclipse.org/articles/Article-Workbench-DND/drag_drop. html

"hortiz" <hortiz@xxx.com> wrote in message
news:d147tq$c71$1@www.eclipse.org...
> Hi,
>
> I use a Tree viewer as a Drag source and a Composite as a Drop target.
> Users can so drag and drop tree nodes content.
>
> I'm now asked to modify this by creating a new Composite (in a new Shell)
> if the user drops the tree node outside the existing drop target.
>
> So I have now one drag source and two distinct drop targets.
>
> To determine whether the drop has been done on the dedicated Composite or
> outside, I read the event.detail content in the dragFinished method, if it
> is equal to DND.DROP_NONE, the drop has been done outside the Composite.
>
> Is it a good way to do this ???
>
> Thanks
> Helene
>
>
Re: Drag And Drop Best practice ? [message #452571 is a reply to message #452203] Tue, 22 March 2005 17:02 Go to previous messageGo to next message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 96
Registered: July 2009
Member
Hi,

I've implemented a DragSourceListener on a TreeViewer which allows to drag
a tree node from this tree and to drop it anywhere on the desktop, so I
don't define any specific DropTarget.

It works fine but I'm now asked to determine the exact drop position,
however, in the dragFinished method, the given DragSourceEvent object
doesn't provide this information (such as event.x, event.y).

How could I determine drop position in this particular case ?

Thanks,
Helene
Re: Drag And Drop Best practice ? [message #453291 is a reply to message #452571] Mon, 04 April 2005 19:26 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
This information is not provided. Why does the drag source need to know the
drop position of the target? It could be a different application - what can
you infer from the position?

"hortiz" <hortiz@xxx.com> wrote in message
news:15dba8b3f9ad1fdc688c52ab6f6c495d$1@www.eclipse.org...
> Hi,
>
> I've implemented a DragSourceListener on a TreeViewer which allows to drag
> a tree node from this tree and to drop it anywhere on the desktop, so I
> don't define any specific DropTarget.
>
> It works fine but I'm now asked to determine the exact drop position,
> however, in the dragFinished method, the given DragSourceEvent object
> doesn't provide this information (such as event.x, event.y).
>
> How could I determine drop position in this particular case ?
>
> Thanks,
> Helene
>
>
Re: Drag And Drop Best practice ? [message #453311 is a reply to message #453291] Tue, 05 April 2005 07:06 Go to previous message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 96
Registered: July 2009
Member
Hi Veronika,

The drag source needs to know the drop position to open a new Shell
instance at this position.

I've managed to do that by using Display.getCursorLocation().

Thanks,

Helene
Previous Topic:JDOM runs in normal mode, crashes in Debug mode
Next Topic:Text widget + background image
Goto Forum:
  


Current Time: Thu Apr 25 04:01:19 GMT 2024

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

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

Back to the top