Solved

Right mouse click event

Posted on 2002-07-25
3
181 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now