In GWT, how do I get the “mouseUp” events when dragging an element?
I’d like to get the following flow:
- mouseDown
- mouseMove
- … some more mouseMove possibly…
- mouseUp
I can get “mouseDown” and “mouseUp” when I do not move the cursor but the instant I move the cursor, I don’t get “mouseUp” events anymore.
I’ve tried to put event.preventDefault(); in both “mouseDown” and “mouseMove” handlers to no avail.
Please help.
For DnD you generally need to
setCapture. And don’t forget toreleaseCapturewhen you stop dragging (e.g. mouse up and/or escape key).Have a look at the code of
com.google.gwt.user.client.ui.DialogBox, which does just that.