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!");
                        } });

        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to