When dropping an element, a dropOut event is always triggered before the drop event.
Here is a code sample that triggers it:
VLayout layout = new VLayout();
layout.setWidth100();
layout.setHeight100();
Button b = new Button("Drop me on the red canvas");
b.setCanDrag(true);
b.setCanDrop(true);
layout.addMember(b);
Canvas c = new Canvas();
c.setCanAcceptDrop(true);
c.setBackgroundColor("red");
c.setWidth100();
c.setHeight100();
c.addDropHandler(new DropHandler() {
@Override
public void onDrop(DropEvent event) {
GWT.log("drop");
}
});
c.addDropOutHandler(new DropOutHandler() {
@Override
public void onDropOut(DropOutEvent event) {
GWT.log("dropout");
}
});
layout.addMember(c);
layout.draw();
This requires the application to do some extra checks to distinguish between a real drop out when the mouse actually leaves the drop target and a bad one that should be ignored.
SmartGWT version: SNAPSHOT_v11.1d_2017-01-05
Tested on Chrome 55.0.2883.87 and Firefox 50.1.0
Here is a code sample that triggers it:
VLayout layout = new VLayout();
layout.setWidth100();
layout.setHeight100();
Button b = new Button("Drop me on the red canvas");
b.setCanDrag(true);
b.setCanDrop(true);
layout.addMember(b);
Canvas c = new Canvas();
c.setCanAcceptDrop(true);
c.setBackgroundColor("red");
c.setWidth100();
c.setHeight100();
c.addDropHandler(new DropHandler() {
@Override
public void onDrop(DropEvent event) {
GWT.log("drop");
}
});
c.addDropOutHandler(new DropOutHandler() {
@Override
public void onDropOut(DropOutEvent event) {
GWT.log("dropout");
}
});
layout.addMember(c);
layout.draw();
This requires the application to do some extra checks to distinguish between a real drop out when the mouse actually leaves the drop target and a bad one that should be ignored.
SmartGWT version: SNAPSHOT_v11.1d_2017-01-05
Tested on Chrome 55.0.2883.87 and Firefox 50.1.0
Comment