[image of digits]
MouseDown Event Parameters

void __fastcall TForm1::PaintBoxMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{

int shft = Shift.ToInt();
if (shft == 34) { /* doSomething() */ } // Alt / Wheel Click

}

Button gives you the mouseClick that fired the event: 0 = Left; 1 = Right, 2 = Wheel

Shift gives you the status of all three Buttons (Left, Right, Wheel and double clicks) plus all three Shift keys (Cntl; Alt; Shift). A double-click adds bit 7 (decimal 64) to the sum of the different independent keys clicked.


forward. The help file gave the variables ssShift , ssAlt, ssCtrl,
ssLeft, ssRight, ssMiddle, and ssDouble for the shift state. I found
that you can interact with these via the code

if (Shift.Contains(ssAlt)) { do something }

X and Y give you the coordinates where the MouseDown occurred.

Contributed by Matt: A simpler approach...

Shift monitors the Cntl, Alt and Shift keys as well as the Left, Right, and Wheel Mouse Buttons for click and double-click.

The following variables monitor the status of the corresponding buttons and keys:
ssLeft, ssRight, ssMiddle, ssDouble, ssShift, ssAlt and ssCtrl.

Example:

if (Shift.Contains(ssAlt)) { do something }

Shift monitors the Cntl, Alt and Shift keys as well as the Left, Right, and Wheel Mouse Buttons for click and double-click.
It provides data on the states of all seven variables: "0" means it is not down. "1" means that it is down.
That data is stored as 7 bits according the the table below.
Please note that Shift can represent every combination of those 7 states, a total of 128 in all.
Shift provides us with the 7-bit binary code. Shift.ToInt() will translate Shift into its decimal equivalent.
"If" statements can distinguish these combinations, for example:

int shft = Shift.ToInt();
if (shft == 20) { /* doSomething() */ } // Cntl / Right Click

For most applications, we should confine ourselves to 1 button press and 1 key press; these combinations are colored yellow.
This gives us 12 relatively simple combinations to work with.

Shift.ToInt() Left Right Wheel
nokey 8 16 32
shift 9 17 33
alt 10 18 34
shift/alt 11 19 35
ctrl 12 20 36
shift/ctrl 13 21 37
ctrl/alt 14 22 38
ctrl/alt/shift 15 23 39

The 64 possible combinations in the long chart at the bottom of this page have been colored according to the number of Button and Key presses. Combination Button presses can also be captured.

Not Available for MouseDown  
Recommended:
1 Button / 1 Key
 
1 Button / 2 keys  
1 Button / 3 Keys  
2 Buttons / any Keys  
3 Buttons / any Keys  
Double-Clicks Combinations  

 

Shift.ToInt()              
Decimal Double Wheel Right Left Cntl Alt Shift
0   0 0 0 0 0 0
1   0 0 0 0 0 1
2   0 0 0 0 1 0
3   0 0 0 0 1 1
4   0 0 0 1 0 0
5   0 0 0 1 0 1
6   0 0 0 1 1 0
7   0 0 0 1 1 1
8 L   0 0 1 0 0 0
9   0 0 1 0 0 1
10   0 0 1 0 1 0
11   0 0 1 0 1 1
12   0 0 1 1 0 0
13   0 0 1 1 0 1
14   0 0 1 1 1 0
15   0 0 1 1 1 1
16 R   0 1 0 0 0 0
17   0 1 0 0 0 1
18   0 1 0 0 1 0
19   0 1 0 0 1 1
20   0 1 0 1 0 0
21   0 1 0 1 0 1
22   0 1 0 1 1 0
23   0 1 0 1 1 1
24   0 1 1 0 0 0
25   0 1 1 0 0 1
26   0 1 1 0 1 0
27   0 1 1 0 1 1
28   0 1 1 1 0 0
29   0 1 1 1 0 1
30   0 1 1 1 1 0
31   0 1 1 1 1 1
32 W   1 0 0 0 0 0
33   1 0 0 0 0 1
34   1 0 0 0 1 0
35   1 0 0 0 1 1
36   1 0 0 1 0 0
37   1 0 0 1 0 1
38   1 0 0 1 1 0
39   1 0 0 1 1 1
40   1 0 1 0 0 0
41   1 0 1 0 0 1
42   1 0 1 0 1 0
43   1 0 1 0 1 1
44   1 0 1 1 0 0
45   1 0 1 1 0 1
46   1 0 1 1 1 0
47   1 0 1 1 1 1
48   1 1 0 0 0 0
49   1 1 0 0 0 1
50   1 1 0 0 1 0
51   1 1 0 0 1 1
52   1 1 0 1 0 0
53   1 1 0 1 0 1
54   1 1 0 1 1 0
55   1 1 0 1 1 1
56   1 1 1 0 0 0
57   1 1 1 0 0 1
58   1 1 1 0 1 0
59   1 1 1 0 1 1
60   1 1 1 1 0 0
61   1 1 1 1 0 1
62   1 1 1 1 1 0
63   1 1 1 1 1 1
64 1 0 0 0 0 0 0
65 1 0 0 0 0 0 1
66 1 0 0 0 0 1 0
67 1 0 0 0 0 1 1
68 1 0 0 0 1 0 0
69 1 0 0 0 1 0 1
70 1 0 0 0 1 1 0
71 1 0 0 0 1 1 1
72 LL 1 0 0 1 0 0 0
73      
74      
75      
76      
77      
78      
79      
80 RR      
81      
82      
83      
84      
85      
86      
87      
88 LRR RLL      
89      
90      
91      
92      
93      
94      
95      
96 WW      
97      
98      
99      
100      
101      
102      
103      
104      
105 LWW WLL      
106      
107      
108      
109      
110      
111      
112 RWW WRR      
113      
114