With a simple javascript I can have the mouseposition anytime:

<!--
document.onmousemove = mouseMove;

function mouseMove(ev){
        ev           = ev || window.event;
        var mousePos = mouseCoords(ev);

        //document.Show.MouseX.value = mousePos.x;
        //document.Show.MouseY.value = mousePos.y;
}

function mouseCoords(ev){
        if(ev.pageX || ev.pageY){
                return {x:ev.pageX, y:ev.pageY};
        }
        return {
                x:ev.clientX + document.body.scrollLeft - 
document.body.clientLeft,
                y:ev.clientY + document.body.scrollTop  - 
document.body.clientTop
        };
}
//->

How can I implement this in GWT and assign mousePos.x and mousePos.y
to class attributes?



On 15 jul, 05:15, Carver <[email protected]> wrote:
> Javascript will only give you a mouse position in response to an
> event, AFAIK.  Of course, events happen all the time (eg~ the mouse
> moving).  So you just need to decide which element in GWT is listening
> for that event.  See all the known objects that have the mouse move
> handler 
> here:http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...
>
> GWT has a FocusPanel (ie~ a Panel that captures mouse and keyboard
> events), but does not seem to have an equivalent FocusPopupPanel.  So
> you might want to do something like add a FocusWidget to your
> PopupPanel.
>
> ~Carver
>
> Slique.com - builds group memory by putting all your group's email,
> files and documents in one place
> I'm trying this out:http://five.sentenc.es/
>
> On Jul 14, 9:41 am, Frank <[email protected]> wrote:
>
> > Hi,
>
> > I'm trying to get the cursor position on a page made with GWT. But I
> > can't find any function to do this
>
> > How can I get the x,y coordinates of my pointer. (I want to use this
> > with a popup window)
>
> > Regards,
>
> > Frank

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