Mouse Button Click

If you need to determine which button is clicked on a mouse with a ClickHandler, you can use the NativeEvent class. Here is code that determines whether or not the ClickHandler was trigger by a right click or not (event is ClickEvent):

if(event.getNativeEvent().getButton() == NativeEvent.BUTTON_RIGHT)

{

GWT.log("Right Click", null);

}

else

{

GWT.log("Left Click", null);

}

No comments:

Post a Comment