Principles of use
Knowing when to use which types of events is important even in this design. Let's say, for example, that you only want a callback to be called once for a binding that involves the left shift and the R key. You wouldn't define both the event types as Keyboard, because that would keep invoking the callback method as long as these keys are down. You also don't want to define both of them as KeyDown events, because that would mean that both of these events would have to be registered at the same time, which, when holding down multiple keys, is likely not going to happen because of the screen refresh rate. The correct way to use this is mixing the Keyboard and KeyDown events so that the very last key to be pressed is the KeyDown
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access