On 17 juin, 10:06, ruds <[email protected]> wrote:
> Hello there,
> I have a focus panel where i added a MouseDownHandler to it. now in my
> MouseHandler i am doing the following:
> public void onMouseDown(MouseDownEvent arg0) {
> if(arg0.getNativeEvent().getKeyCode()==Event.BUTTON_LEFT){
>
> }else if(arg0.getNativeEvent().getKeyCode()==Event.BUTTON_RIGHT){
> }
>
> The strange thing is IE, the keyCode returned if i do debug it is
> always 0, it is working fine over FF and chrome and i need this in
> order to differentiate right from left clicks.
>
> is this a browser compatibility issue or a gwt bug?

Or a bug in your code? You're comparing mouse button codes with
keyboard codes!
You should use arg0.getNativeButton(), or eventually
arg0.getNativeEvent().getButton().
Also note that more than one button can be depressed at the same time,
the value returned is a bit-field, so if you want to know if the left
button is depressed, you should use
arg0.getNativeButton&NativeEvent.BUTTON_LEFT!=0, you'd use
arg0.getNativeButton()==NativeEvent.BUTTON_LEFT only you want to check
that the left button, and only the left button, is depressed.

-- 
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.

Reply via email to