Obtaining the click position of the underlying widget from an overlay widget

2011-08-16 Thread Alexander Orlov
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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Obtaining the click position of the underlying widget from an overlay widget

2011-08-16 Thread Ivan Pulleyn
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
alexander.or...@loxal.netwrote:

 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 google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Obtaining the click position of the underlying widget from an overlay widget

2011-08-16 Thread Alexander Orlov
On Tue, Aug 16, 2011 at 2:38 PM, Ivan Pulleyn ivan.pull...@gmail.comwrote:


 I believe you want this:

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


Unfortunately not, I always get:

event.x = -266
 event.y = -133


...no matter where on the FocusPanel I click, the value remain static. When
I click on another FocusPanel the values change but reamin static within the
same FocusPanel.




 On Tue, Aug 16, 2011 at 7:26 PM, Alexander Orlov 
 alexander.or...@loxal.net 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 google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 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 google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.




-- 
www.loxal.net
Mobile: +49 176 4440-3969
Rablstr. 12 • 81669 Munich • Germany

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.