DemoOpenGLCanvas and keyPressed

I’ve been trying to get keyPressed working with DemoOpenGLCanvas in the juce demo but I have been unsuccessful. As far as I can tell since DemoOpenGLCanvas subclasses Component, it should work, but alas, it does not. Please tell me the error in my ways!

As a base example, I added the following code to OpenGLDemo.cpp, right below the mouse drag method

bool keyPressed (const KeyPress& key) { Logger::outputDebugString(String(key.getTextCharacter())); return true; }

…and it never gets called.

Could just be that you’ve not called setWantsKeyboardFocus() or something to let your comp actually get focused?

DOH! I knew it would be simple, thanks Jules.