• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic