Riley Lark
Riley Lark

Reputation: 20890

Surely there's a way to simulate a click on a HasClickHandlers object in GWT

When I use Buttons, I can just call button.click() to simulate a click. Now I have a reference to a HasClickHandlers (might be a button, might be an image, etc), but can't figure out how to click it!

Is it possible? I'm using GWT 2.1

Upvotes: 4

Views: 2049

Answers (2)

LINEMAN78
LINEMAN78

Reputation: 2562

You can use the following and populate the fields as needed such as screen position and such.

DomEvent.fireNativeEvent(Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false), button);

Upvotes: 4

Uri
Uri

Reputation: 89749

Can't you invoke fireEvent() from the superinterface HasHandlers?

Also, take a look at this post.

Upvotes: 1

Related Questions