Solved

Right mouse click event

Posted on 2002-07-25
3
184 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 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