I believe you want this:

int x = event.getRelativeX(event.getRelativeElement());
int y = event.getRelativeY(event.getRelativeElement());


On Tue, Aug 16, 2011 at 7:26 PM, Alexander Orlov
<[email protected]>wrote:

> I have something like
>
> <g:ScrollPanel>
>     </g:FocusPanel>
> <!-- a few FocusPanels -->
> </g:ScrollPanel>
>
> The FocusPanel is attached to a random place within the ScrollPanel. Now I
> want to get the position of the place where the user places his click. I've
> tried the following
>
> focusPanel.addClickHandler(new ClickHandler() {
>             @Override
>             public void onClick(ClickEvent event) {
>               System.out.println(event.getClientX());
>                 System.out.println(event.getX());
>
> System.out.println(event.getRelativeX(event.getRelativeElement().getOffsetLeft()));
>
> System.out.println(event.getRelativeElement().getOffsetLeft());
>
> System.out.println(event.getRelativeElement().getOffsetWidth());
>
> System.out.println(event.getRelativeElement().getOffsetHeight());
>
> System.out.println(event.getRelativeElement().getOffsetTop());
>                 System.out.println(event.getScreenX());
>             }
> }
>
> ...but I always get the same values, no matter where I place my click on
> the focusPanel.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/J4cH7AUDKBcJ.
> 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.
>

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