Rori Stumpf
unread,Jan 24, 2012, 2:44:37 PM1/24/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
Following the example from Google I/O 2011 (youtube video), I wrote
the following code which successfully implements drag and drop on
Chrome, Firefox and Safari.
But, of course, it does not work with IE9..
Here is the code... any obvious problems? What's up with GTW & native
drag and drop with IE9?
Thanks in advance... (p.s. I'd prefer to stick with native rather than
use a lib)
public void onModuleLoad() {
RootPanel.get("flow").add(dropLabel);
RootPanel.get("flow-components").add(dragLabel);
// Configure the draggable element
dragLabel.getElement().setDraggable(Element.DRAGGABLE_TRUE);
dragLabel.addDragStartHandler(new DragStartHandler() {
@Override
public void onDragStart(DragStartEvent event) {
event.setData("text", "drag-data");
event.getDataTransfer().setDragImage(dragLabel.getElement(), 0,
0);
} });
// Configure the drop target
dropLabel.addDragOverHandler(new DragOverHandler() {
@Override
public void onDragOver(DragOverEvent event) {
dropLabel.setText("Dragging Over");
} });
dropLabel.addDragLeaveHandler(new DragLeaveHandler() {
@Override
public void onDragLeave(DragLeaveEvent event) {
dropLabel.setText("Drop Here");
} });
dropLabel.addDropHandler(new DropHandler() {
@Override
public void onDrop(DropEvent event) {
Window.alert("Dropped!");
} });
}