Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Special dnd features
Special dnd features [message #446748] Thu, 02 December 2004 05:44 Go to next message
Eclipse UserFriend
Hi,

I use a TreeViewer as a DragSource and a Composite as a DropTarget, thus,
I can drag a tree item and drop a representation of it in my Composite
instance.

I would like to implement special features such as :

- to view data associated with the selected tree item, the user simply
drags and drops it,

- to modify data associated with the selected tree item, the user should
press "CTRL" (on Linux) or "Apple" (on Mac) key while dragging.

I've managed to detect if a key is pressed but not particularly the CTRL
one...

Thanks
Helene
Re: Special dnd features [message #446753 is a reply to message #446748] Thu, 02 December 2004 08:43 Go to previous message
Eclipse UserFriend
In the dragEnter event and the dragOperationChanged event you can determine
the key modifier pressed by looking at the event.operation field. Of
particular interest to you would be the values below:

/**
* Drag and Drop Operation: During a dragEnter event or a
dragOperationChanged, if no modifier keys
* are pressed, the operation is set to DROP_DEFAULT. The application can
choose what the default
* operation should be by setting a new value in the operation field. If no
value is choosen, the
* default operation for the platform will be selected (value is 1 <<
4).
*
* @see DropTargetListener#dragEnter
* @see DropTargetListener#dragOperationChanged
* @since 2.0
*/
public final static int DROP_DEFAULT = 1 << 4;

/**
* Drag and Drop Operation: a copy of the data in the drag source is
* added to the drop target (value is 1 &lt;&lt; 0).
*/
public final static int DROP_COPY = 1 << 0;

"hortiz" <hortiz@nospam.com> wrote in message
news:comrmr$b1j$1@www.eclipse.org...
> Hi,
>
> I use a TreeViewer as a DragSource and a Composite as a DropTarget, thus,
> I can drag a tree item and drop a representation of it in my Composite
> instance.
>
> I would like to implement special features such as :
>
> - to view data associated with the selected tree item, the user simply
> drags and drops it,
>
> - to modify data associated with the selected tree item, the user should
> press "CTRL" (on Linux) or "Apple" (on Mac) key while dragging.
>
> I've managed to detect if a key is pressed but not particularly the CTRL
> one...
>
> Thanks
> Helene
>
>
>
>
>
Previous Topic:[MacOS X] cross-platform export
Next Topic:CoolBars
Goto Forum:
  


Current Time: Tue Jul 08 11:20:09 EDT 2025

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

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

Back to the top