Wednesday, October 26, 2011

Drag and Drop to a RichTextArea / IFrame?

I'm trying out some of the fun drag-and-drop stuff in GWT. My current
attempt is to drag a file into a richtextarea, but nothing seems to be
working correctly. It works fine if I use a FlowPanel or some other
GWT widget, but not a RichTextArea despite it have an addDropHandler
method.

Anyone have any experience with this?

My code in onModuleLoad:

DropHandler drop = new DropHandler() {

@Override
public void onDrop(DropEvent event) {
event.preventDefault();

String data = event.getData("text");
GWT.log("text is "+data+" and there are
"+numFiles(event.getDataTransfer())+" files");
}
};
RichTextArea rt = new RichTextArea();
rt.addDropHandler(drop); // never called even after drag-and-dropping
a file on the rt
RootPanel.get().add(rt);

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

No comments:

Post a Comment