Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my code i want to detect if the user pressed the right mouse click.

What I have tried:

i wrote
and it doesn't work, but if i type
(left mouse click) it's work.
what's wrong?
Updated 27-Sep-22 4:12am
Richard MacCutchan 27-Sep-22 9:32am    
See below.
NoName900 27-Sep-22 9:42am    
i tried MouseEvent.Button2, doesn't work either

1 solution

The MousEvent button values correspond to their names, i.e BUTTON3 value is 3, not 1. But you should really call the getButton method to find out which button was pressed.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900