Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Multiple DropTargets
Multiple DropTargets [message #465644] Fri, 16 December 2005 01:32 Go to next message
Eclipse UserFriend
Originally posted by: dank.webreachinc.com

I have droptarget 1 and 2. I have dragsource 1 and 2. You can drag from
1 to 1 and from 2 to 2 but not 1 to 2 or 2 to 1 (when talking about
sources and targets respectively). In the drop method, I can check the
event.data to make sure that this action is ignored if incorrect but the
cursor still shows up as a valid drop point. I'd like the cursor to turn
into the circle with a line through it if you drag 1 to 2.

This should be as simple as checking the event.data in the dragOver()
method (or any of the other provided methods I can implement), but for
some reason the event.data is always null in these methods. Therefore I'm
stumped. I don't know how to accomplish this task.

Thanks,
Dan
Re: Multiple DropTargets [message #465717 is a reply to message #465644] Tue, 20 December 2005 12:43 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
See DropTarget section of :
http://eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html

What you are trying to do is only supported on Windows:

public void dragOver(DropTargetEvent event) {
event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
if (textTransfer.isSupportedType(event.currentDataType)) {
// NOTE: on unsupported platforms this will return null
Object o = textTransfer.nativeToJava(event.currentDataType);
String t = (String)o;
if (t != null) System.out.println(t);
}
}

"Daniel Kaplan" <dank@webreachinc.com> wrote in message
news:d1c01b8cff1bcfa50613428bcf30995d$1@www.eclipse.org...
>I have droptarget 1 and 2. I have dragsource 1 and 2. You can drag from 1
>to 1 and from 2 to 2 but not 1 to 2 or 2 to 1 (when talking about sources
>and targets respectively). In the drop method, I can check the event.data
>to make sure that this action is ignored if incorrect but the cursor still
>shows up as a valid drop point. I'd like the cursor to turn into the
>circle with a line through it if you drag 1 to 2.
> This should be as simple as checking the event.data in the dragOver()
> method (or any of the other provided methods I can implement), but for
> some reason the event.data is always null in these methods. Therefore I'm
> stumped. I don't know how to accomplish this task.
>
> Thanks,
> Dan
>
Previous Topic:Need help with a Property Editor using Tree.
Next Topic:scrollbars are not moving using mouse wheels
Goto Forum:
  


Current Time: Sun Dec 08 19:54:52 GMT 2024

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

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

Back to the top