Correct way to manage key combinations

Coordinator
Aug 20, 2011 at 3:35 AM

The current design is on key down we check the current set of keys for an exact match to the set we're looking for. This may not be the right way. What this does:

Have events set up for "M", "S", and "M+S".
1. Press "M". Fire "M" event.
2. Press "S". Fire "M+S" event.
The "S" event never gets fired.

Another option is to check for all subsets of the currently pressed keys. But then if you have two events for "Ctrl+A" and "Ctrl+Shift+A" then:
1. Press "Ctrl".
2. Press "Ctrl+Shift".
3. Press "Ctrl+Shift+A". Fire both "Ctrl+A" and "Ctrl+Shift"+A" events.
That doesn't seem right?

Mar 10, 2012 at 10:52 PM

I don't see any alternatives that are acceptable, so I would stick with the current implementation.