Right & proper way of getting key-presses in Console App



I’m working on a Juce console app here, so far JUCEApplication::initialize() registers a broadcast listener with the message manager, which is sufficient to get the event loop up and running. That part of life is good.

Now I’d like to also get and handle keyboard events, as simply as possible. But I’m at a loss because in the console app I don’t have any Components, which is where keyboard stuff usually hooks in, right?

Is there a good and simple way to get past this? I’d settle for a bad but grudingly-accepted way of hacking through it, if that’s all there is…

Martin Sz.


(Don’t think I’ve done a console app like that since the 1980’s…) so not sure even how they work with keyboard input these days.

I guess the only neat way to do it would be to write some sort of Console singleton class to represent the console, and then KeyListeners could register themselves with it.