Keylistener help


I am currently trying to use the KeyListener and cannot get it to work. In the past i have written programs using JUCE and am using them as a reference on how to use this, i have copied it exactly but it wont work on my new program.

I would like to respond to key events in the Main component class.

In the header i have done this:

class MainContentComponent : public Component, public KeyListener

bool keyPressed(const KeyPress &key, Component* originatingComponent ) override;


Then in the main component constructor i have added the listener like this:


Then i have set up DBG and break points in the function to see if i am getting anything:

bool MainContentComponent::keyPressed(const KeyPress &key, Component* originatingComponent )

I’m hoping theres a very simple answer to this question, I have throughly checked my other programs where i have used this and can’t figure out what’s different. Any help would be much appreciated, thank you!