Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Right mouse click event

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

647 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