Hatchmaster
Hatchmaster

Reputation: 113

GWT Canvas - How do I get the mouse location on the Canvas during a KeyPress event?

I have a GWT application with a Canvas. I added several event handlers to the canvas, including a KeyPressedHandler.

When the user presses a key and the KeyPressEvent is fired, I want to find out the mouse's location within the Canvas (similar to that provided by MouseEvent.getX(), MouseEvent.getY(). However, neither KeyPressEvent nor NativeEvent provide this information as far as I can tell. How can I obtain it?

Thanks!

Upvotes: 0

Views: 292

Answers (1)

funkybro
funkybro

Reputation: 8671

A MouseMoveHandler will help, but this won't work until the user actually moves the mouse...

Upvotes: 1

Related Questions