Recommended Way For Handling Application Key Presses


#1

Currently I’m just using the KeyListener class for handling key presses for each component, however I’ve noticed that in the Projucer the KeyListener class isn’t used (e.g. the backspace key deletes elements in the GUI editor) and the key presses are handled elsewhere.

Is there a useful class/ recommended way of handling application wide key presses such as delete, cut, copy, etc.?


#2

Using an ApplicationCommandManager and ApplicationCommandTargets is the way to go - you can set keypresses for commands by using the ApplicationCommandInfo::addDefaultKeypress() method.

Take a look at the KeyMappingsDemo and MenusDemo for some examples.


#3

Perfect, thanks ed!