T
T
Troodi Larson2018-03-13 11:18:20
.NET
Troodi Larson, 2018-03-13 11:18:20

3 key combination not working?

Hello everyone, in the program I wanted to implement a keyboard shortcut, but with three keys. With two, everything is extremely simple, but is it really impossible to do for three, or is it only with the help of WinAPI? For example ctrl+c+q.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
cicatrix, 2018-03-13
@cicatrix

A combination of three keys is possible if two of them are modifier keys (Ctrl, Shift or Alt).
Actually, out of two keys it is also possible only if one of them is the same modifier.
For the rest, "chords" are made (as, for example, in Visual Studio - first Ctrl + something is pressed, the program waits for the "chord" to continue, the command is executed when the next key is pressed).

#
#, 2018-03-13
@mindtester

in the same forms there are 2 types of events:
- KeyPress - most often used, but it occurs when a key is pressed and then released (not a modifier, "normal")
- KeyDown / KeyUp - these honestly work out each press and release. you can dig in that direction. when you press the desired key, set your internal flag (by the way, this is how drivers work with modifiers) when released - remove the flag .. when you catch the 3rd key being pressed (here in any way) - if both the modifier is pressed and your internal flag is set - this is there is a necessary situation,
but you shouldn’t be too smart in this area at all - in VS ctrl + k then + c is commenting on the selected block, but this is a sequence, not a simultaneous combination
your idea may turn out to be unstable in implementation, and contradict the general stereotypes of behavior ..
sometimes it is useful to break stereotypes, and sometimes there is no
ps
for form components, in the "properties" window of the studio, there is an "events" tab .. it is also easy to create handlers there ( click) and cancel them, and use the F1 button to call MSDN, for a Russian studio, a significant part in Russian (unlike search engines)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question