Another simpler solution using EventPreview:

Event.addNativePreviewHandler(new Event.NativePreviewHandler()
{
     public void onPreviewNativeEvent(NativePreviewEvent foEvent)
     {
        switch(foEvent.getTypeInt())
        {
           case Event.ONCLICK: handleClick(foEvent); break;
           case Event.ONMOUSEOVER: handleMouseOver(foEvent); break;
        }// end switch
     }
});


Regards.

On Tue, Jan 26, 2010 at 3:09 PM, DaveC
<[email protected]>wrote:

> The way I've done it (I think is):
>
> 1. Create a new Class that extends Widget and implements
> HasMouseMoveHandlers
>
> 2. Grab the RootPanel Element and pass that into your new Class
> constructor (the one that takes an Element as a param) - this should
> call setElement(Element element) with you passed in element...
>
> You can now add MouseMove handlers to you new Widget...
>
> On Jan 26, 12:49 am, markww <[email protected]> wrote:
> > Hi,
> >
> > Is there a way to listen for mousemoves on the main document? In
> > javascript, I usually do this:
> >
> >   window.onload = function() {
> >       document.onmousemove = function(e) {
> >           alert("the mouse was moved!");
> >       };
> >   }
> >
> > can we add some sort of similar listener in GWT? I'm just not sure
> > where to start,
> >
> > Thanks
>
> --
> 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]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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