Noor
Noor

Reputation: 20150

GWT set cursor to a position (x,y)

in GWT, Is it possible to set the cursor position to a location (x,y) (top,left) ??

Upvotes: 0

Views: 2823

Answers (2)

okrasz
okrasz

Reputation: 3974

Setting mouse cursor is not possible in JS, due to security. Think of entering a site which suddenly starts to move your mouse for you ... and possibly click ads on this site. Would you add such feature to browser?

Upvotes: 0

BobV
BobV

Reputation: 4173

Are you referring to the mouse cursor? If so, browsers don't provide an API for setting the position of the mouse cursor.

If you're talking about a text insertion caret in a TextArea or similar widget, you can use TextBoxBase.setCursorPos() to set the caret to a particular offset within the text.

Upvotes: 2

Related Questions