Based on Kelo's example above:
public class BocaJrsTable extends FlexTable implements
HasMouseOutHandlers {
// ... as above, but add the following:
public int[] getCellForEvent(final MouseEvent<?> event) {
final Element td =
getEventTargetCell(Event.as(event.getNativeEvent
()));
if (td == null) {
return null;
}
final Element tr = DOM.getParent(td);
final Element body = DOM.getParent(tr);
final int r = DOM.getChildIndex(body, tr);
final int c = DOM.getChildIndex(tr, td);
final int[] idx = new int[] { r, c };
return idx;
}
}
someTable = new BocaJrsTable();
someTable.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(final MouseOverEvent event) {
final int r = row(event);
...
}}
);
public static int row(final MouseEvent<?> event) {
// note that in general, events can have sources that are not
Widgets.
BocaJrsTable sender = (BocaJrsTable) event.getSource();
final int[] idx = sender.getCellForEvent(event);
if (idx == null) {
return -1;
}
return idx[0];
}
I hope that helps,.
Cheers,
C.
On Aug 8, 3:51 am, Wimpog <[email protected]> wrote:
> I would also like to know how to find out which row mouseEvent has
> occurred....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---