Friday, July 27, 2012

Re: DragOverEvent issue

This is the expected behavior (a security measure): ("protected mode" changes the behavior of getData to return early; basically you can know the type of data that's being dragged, but not the actual data).
GWT does not expose the "types" property (JsArrayString), and I don't know how well it's supported across browsers…

On Friday, July 27, 2012 3:52:29 PM UTC+2, Thomas Lefort wrote:
I have an issue with DragOverEvent.

At drag start I set my event data to a certain value, as follows:

panel.addDomHandler(new DragStartHandler() {
public void onDragStart(DragStartEvent event) {
event.setData("text", ResourceWidget.this.resource.getClass().getName());
event.getDataTransfer().setDragImage(panel.getElement(), 10, 10);
                                                ... some more code
}, DragStartEvent.getType());

On hover and on drop I test the value of the event data as follows:

campaignMap.addDomHandler(new DragOverHandler() {
public void onDragOver(DragOverEvent event) {
   if(event.getData("text") != null) {
                                              (1)  ... some more code
}, DragOverEvent.getType());
campaignMap.addDomHandler(new DropHandler() {
public void onDrop(DropEvent event) {
   if(event.getData("text") != null) {
                                              (2)  ... some more code
}, DropEvent.getType());
The issue is that with the hover event I get always null for my data value whilst for the drop I get the right value, ie (1) is never run and (2) runs.

In the end the drag and drop works, but I would also like to make use of the drag event to display some information based on the value of the data.

Any idea? is this a bug?



You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment