Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to detect simultaneous left and right mouse clicks Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
19-Aug-03
Category
Algorithm
Language
Delphi 2.x
Views
178
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jorge Abel Ayala Marentes

How to known if the user has pressed simultaneously the left and right mouse 
buttons?

Answer:

The OnMouse event is declared as follows: 
1   
2   procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
3     Shift: TShiftState; X, Y: Integer);
4   
5   if you find in the Classes unit the declaration of TShiftState is: 
6   
7   TShiftState = set of (ssShift, ssAlt, ssCtrl,
8     ssLeft, ssRight, ssMiddle, ssDouble);
9   
10  So you need to test if sLeft and ssRight are present in the Shift parameter, now 
11  your code must be like this: 
12  
13  procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
14    Shift: TShiftState; X, Y: Integer);
15  begin
16    if (ssRight in Shift) and (ssLeft in Shift) then
17      ShowMessage('The user has pressed Left and Right buttons');
18  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC