I’m trying to capture dragover and drop events. Right now I’m capturing those events adding a dom handler to my RootLayoutPanel:
dragOverHandler = RootLayoutPanel.get().addBitlessDomHandler(this, DragOverEvent.getType());
dropHandler = RootLayoutPanel.get().addBitlessDomHandler(this, DropEvent.getType());
The problem is this code does not capture the events when showing a popup and the drag/drop is over the popup itself or the glass around it.
I have also tried using a native preview handler, but it seems it is not called on dragover nor drop events:
Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
GWT.log(event.getNativeEvent().getType());
}
});
Is there a straight way to capture all dragover and drop events in my app?
Thanks
Try using
RootPanel.get()instead ofRootLayoutPanel.get().FYI,
RootLayoutPanel.get()adds theRootLayoutPanelsingleton to theRootPanel.get();RootPanel.get()wraps the document’s<body>inside aRootPanel, so it should capture everything (provided the body fills the viewport, which theRootLayoutPanelensures).