?
Solved

Right mouse click event

Posted on 2002-07-25
3
Medium Priority
?
187 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 200 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

Independent Software Vendors: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 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