Using Firefox and maybe others modern browsers, we are allowed to select some text of a page, and then Drag and Drop our selection.
The destination of this drag and drop, can be any HTML input, or even the bar address, the search field, etc.
I would like to know if this kind of drag event is handled by the browser in a special way, or if it is possible to capture this (a DOM event or something like that).
To be more specific, I’m trying to add this drop functionality to some GWT objects and then be able to retrieve the selected text.
I’m using GWT.
EDIT, WORKING SOLUTION
This is some relevant code :
TextArea text = new TextArea();
SimplePanel panel = new SimplePanel(text);
TextArea text2 = new TextArea();
SimplePanel panel2 = new SimplePanel(text2);
Button button = new Button("button");
button.addDragOverHandler(new DragOverHandler()
{
@Override
public void onDragOver(DragOverEvent event)
{
GWT.log("onDragOver");
});
RootPanel.get().add(panel);
RootPanel.get().add(panel2);
RootPanel.get().add(button);
Image :

The use of the button is just an example.
The goal here is to retrieve the text I want to drop this text over the button through some handlers on the button.
GWT has built-in support for native drag and drop.
According to your description, you seem to be looking for widgets implementing
HasDropHandlers, and there are a bit more than a few 😉It’s also rather easy to add it to a custom widget (have a look at how it’s done in built-in widgets, such as
FocusPanelorGrid)