Solved

Right mouse click event

Posted on 2002-07-25
3
185 Views
Last Modified: 2010-04-04
Most components have a OnClick event, however, this particular event only occurs when the user presses the primary mouse button (typically the left button).  I would like to know not when the left button is pressed, but rather the right mouse button.  How can I detect a right mouse button OnClick event?
0
Comment
Question by:Monroe406
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 7

Accepted Solution

by:
Cynna earned 50 total points
ID: 7178583
Well, one way is using OnMouseDown or OnMouseUp events.

For example:

procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button=mbRight then Button1.Caption:='Right button!';
end;
0
 
LVL 7

Expert Comment

by:Cynna
ID: 7178593
You could also use WM_RBUTTONUP or WM_RBUTTONDOWN messages,
but this might be less elegant, depending on what exactly
you want to do...
0
 
LVL 7

Expert Comment

by:Cynna
ID: 7178595
Oh.. well, you're quick one...:)
Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 389
Find and Replace Stream with 0s 8 85
Performance of SQL statement 37 144
How to Get Images From Server using App Tethering 11 51
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question