I have some rather complex click handling code on a widget that has
the following sort of structure:
@Override
public void onBrowserEvent(Event event) {
event.cancelBubble(true);
event.preventDefault();
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
int x = Event.getCurrentEvent().getClientX();
int y = Event.getCurrentEvent().getClientY();
//how to get relative X/Y from the element that
was clicked.
(stuff to run onclick)
case Event....(handles other forms of mouse action)
This works well, and lets handle everything as needed.
However, because I am using a Event rather then a ClickEvent, theres
no easy way to get the x/y of the click relative to the element that
fired it.
Is there any way to get this information?
I dont think I can cast to ClickEvent, so I need to parse over the
whole dom tree to convert from screen x/y to element-relative x/y?
Seems complex Is there a better way?
Thanks,
Thomas
--
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.