Reputation: 109
How can I detect that two or three combination keys are pressed?
For example when i press 'Shift + Ctrl + F1' how can i detect it in 'onKeyDown' event of a textbox?
Upvotes: 2
Views: 2425
Reputation: 613592
The Shift
parameter to OnKeyDown
is a set. It describes the state of all the modifier keys. Test for multiple modifier keys like this:
if (Shift*[ssShift,ssAlt,ssCtrl]) = [ssShift,ssCtrl] then
....
The *
picks out the state of the three modifier keys from Shift
. The test then checks for shift and ctrl being down, but alt not being down.
Such key presses are usually best handled by actions using the ShortCut
property of an action.
Upvotes: 5