Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » DnD with a modifier key
DnD with a modifier key [message #503708] Tue, 15 December 2009 07:38 Go to next message
Karel Brezina is currently offline Karel Brezina
Messages: 68
Registered: July 2009
Member
Hi,

is DnD with a modifier key supported? "DropTargetEvent" does not provide
"stateMask" to check modifier keys.

I just want to distinguish between simple "DnD" and "DnD + Ctrl". Is
there any other way (or workaround) to do it.

Thanks,
Karel
Re: DnD with a modifier key [message #503750 is a reply to message #503708] Tue, 15 December 2009 15:47 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Hi Karel,

Not exactly, but almost. The event's detail field indicates whether the
operation is a move, copy, etc., which is what ultimately matters for DND.
The problem is that the modifiers that distinguish these cases are not
consistent across platforms. For instance, on win32 and gtk: copy ==
DND+ctrl, but on OSX: copy == DND+Alt. This is why the event's stateMask is
abstracted to a DND operation that respects the platform convention. Is
differentiating the type of operation the reason that you want to know the
modifier?

If this is not why you want to know the stateMask, then the only workaround
that comes to mind is to add a DragDetect filter on the Display, as this
event will give you the stateMask at drag time. When you receive the event
you can store its stateMask somewhere until a DropTargetEvent is received
for which you want it. The only case this approach will not catch is
dragging from outside of your app into it.

You may also wish to CC yourself to
https://bugs.eclipse.org/bugs/show_bug.cgi?id=71538 , as this could also
help with what you want.

HTH,
Grant


"Karel Brezina" <karel.brezina@cloudsmith.com> wrote in message
news:hg7uu1$v8r$1@build.eclipse.org...
> Hi,
>
> is DnD with a modifier key supported? "DropTargetEvent" does not provide
> "stateMask" to check modifier keys.
>
> I just want to distinguish between simple "DnD" and "DnD + Ctrl". Is
> there any other way (or workaround) to do it.
>
> Thanks,
> Karel
Re: DnD with a modifier key [message #503770 is a reply to message #503750] Tue, 15 December 2009 16:46 Go to previous message
Karel Brezina is currently offline Karel Brezina
Messages: 68
Registered: July 2009
Member
Thanks Grant. I'll use the DragDetect filter workaround since I want to
use the same modifier key on all platforms. I use DND for a mapping and
DND+ctrl will be used for a special kind of mapping. My usage is a bit
different from the standard MOVE and COPY operations.

Regards,
Karel



Grant Gayed napsal(a):
> Hi Karel,
>
> Not exactly, but almost. The event's detail field indicates whether the
> operation is a move, copy, etc., which is what ultimately matters for DND.
> The problem is that the modifiers that distinguish these cases are not
> consistent across platforms. For instance, on win32 and gtk: copy ==
> DND+ctrl, but on OSX: copy == DND+Alt. This is why the event's stateMask is
> abstracted to a DND operation that respects the platform convention. Is
> differentiating the type of operation the reason that you want to know the
> modifier?
>
> If this is not why you want to know the stateMask, then the only workaround
> that comes to mind is to add a DragDetect filter on the Display, as this
> event will give you the stateMask at drag time. When you receive the event
> you can store its stateMask somewhere until a DropTargetEvent is received
> for which you want it. The only case this approach will not catch is
> dragging from outside of your app into it.
>
> You may also wish to CC yourself to
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=71538 , as this could also
> help with what you want.
>
> HTH,
> Grant
>
>
> "Karel Brezina" <karel.brezina@cloudsmith.com> wrote in message
> news:hg7uu1$v8r$1@build.eclipse.org...
>> Hi,
>>
>> is DnD with a modifier key supported? "DropTargetEvent" does not provide
>> "stateMask" to check modifier keys.
>>
>> I just want to distinguish between simple "DnD" and "DnD + Ctrl". Is
>> there any other way (or workaround) to do it.
>>
>> Thanks,
>> Karel
>
>
Previous Topic:Table lines
Next Topic:How to enable dragging table columns
Goto Forum:
  


Current Time: Mon Oct 20 08:11:06 GMT 2014

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

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