I've been doing this so much lately I've memorized the code. Using
eclipse you'll quickly get proficient at it I'm sure:
class Handlers implements HasMouseOverHandlers, HasMouseOutHandlers {
public void onMouseOver(MouseOverEvent e) {
}
public void onMouseOut(MouseOutEvent e) {
}
}
If you're implementing a new Widget:
class Foo extends Widget implements HasMouseOverHandlers,
HasMouseOutHandlers {
public HandlerRegistration addMouseOverHandler(MouseOverHandler
handler) {
return addDomHandler(handler, MouseOverHandler.getType());
}
public HandlerRegistration addMouseOutHandler(MouseOutHandler
handler) {
return addDomHandler(handler, MouseOutHandler.getType());
}
}
That's it! No more onBrowserEvent, no more sinkEvents. It's all
automatic. Sweet huh?
As for what to do with the HandlerRegistration, read the docs ;-)
Oh, on a related note/warning: I really think GWT should WARN if you
call addHandler with an event type that implements HasNativeEvent. If
you call addHandler instead of addDomHandler, nothing happens and no
events will ever be fired because the events don't get listeners
added. This has already bit me a couple times. Worth filing a bug for
this?
On May 17, 2:03 pm, Salvador Diaz <
diaz.salva...@gmail.com> wrote:
> onMouseLeave:
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...
>
> onMouseEnter (I don't know which so you'll have to try them out):
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...
> orhttp://
google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...