> This has already bit me a couple times. Worth filing a bug for
> this?

I don't think it's worth filing an issue just for this single
documentation "imprecision" (it is briefly mentioned in the the
"What's new" section of the developer documentation and the javadocs
do say that addDomHandler should be used for native browser events). I
do think however, that the coexistence of handlers and listeners in
the javadoc make it more difficult for the beginners to get a grip of
GWT event handling. I don't know what could be done to solve this
though, apart from recommending that beginners should be familiar with
dhtml and javascript basics.

Of course, that's just my opinion, What do other people think of this?

Cheers,

Salvador

On 18 mai, 03:05, Mark  Renouf <[email protected]> wrote:
> 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 <[email protected]> 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...
>
> > Hope that helps,
>
> > Salvador
>
> > On May 17, 7:00 pm, Paul van Hoven <[email protected]>
> > wrote:
>
> > > I imported an GWT 1.5 app for transforming it to a GWT 1.6 app. Every
> > > listener is now marked as deprecated, so i'm currently replacing all
> > > these. Anyway i do not know how to replace my MouseListener
> > > implementations. Concretly speaking i use the folling implementations
>
> > >        public void onMouseEnter(Widget sender) {
> > >                 //..do s.th. here
> > >         }
>
> > >         public void onMouseLeave(Widget sender) {
> > >                 //..do s.th. here
> > >         }
>
> > > that are demanded by the MouseListener interface. But i have not
> > > figured out yet how to replace these with the new handler interfaces.
> > > Does somebody know how to accomplish this?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to