private Icon icon;
+ private boolean clickPending;
+
public IButton() {
setStyleName(CLASSNAME);
}
});
sinkEvents(ITooltip.TOOLTIP_EVENTS);
+ sinkEvents(Event.ONMOUSEDOWN);
+ sinkEvents(Event.ONMOUSEUP);
}
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
+
+ // Handle special-case where the button is moved from under mouse
+ // while clicking it. In this case mouse leaves the button without
+ // moving.
+ if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
+ clickPending = true;
+ }
+ if (DOM.eventGetType(event) == Event.ONMOUSEMOVE) {
+ clickPending = false;
+ }
+ if (DOM.eventGetType(event) == Event.ONMOUSEOUT) {
+ if (clickPending) {
+ click();
+ }
+ clickPending = false;
+ }
+
if (client != null) {
client.handleTooltipEvent(event, this);
}