• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GWT drag&drop how to get widget source on drop event

 
Roy Bean
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to implement an drag & drop in my project. I already managed, but now i want to distinguish the drag source.

I will have two widget from were i can drag lets call widget1 and widget2:

i made the handler for each one

now i had two absolute panels one only can receive from widget 1 and the other from widget 2

how can i manage to do that?

thanks for the help.
 
Julian Downes
Greenhorn
Posts: 1
Google Web Toolkit
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside OnDragStart use event.setData("text", uniqueDragId); where uniqueDragId is a unique drag Id in your application eg "1" or "draggable:1" etc

Then inside OnDrop test event.getData("text"); to determine if it is equal to "1" or whatever.

To get the actual text you are trying to "drop" you reference the object that you know uses the drag Id of "1" and get the text directly from it.

Therefore this whole approach doesn't really drag anything, it just uses the drag metaphor to give your "onDrop" code an id.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic