• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
Google Web Toolkit
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic