Route uncatched keys in the editor to a MidiKeyboardComponent

Is there a way to route keys pressed in the main plugin editor (that are not used by the editor) directly to a MidiKeyboardComponent ?

Because i tried doing something like this (fooling a bit the MidiKeyboardComponent) but i'm getting strange crashes:

bool MyPlugEditor::keyStateChanged(bool isKeyDown)
    // This generates lot of problems !
    return midiKeyboardComponent->keyStateChanged(isKeyDown);

I tried implementing a KeyboardFocusTraverser in the editor and always return the MidiKeyboardComponent that want always the keyboard focus but i'm not able to route keypress the way i want.

I actually want to route uncatched keys to that component even if it has no explicit focus, but i can't find a way to do it unless i trick with the keyStateChanged calls.

Any tips ?

The keyStateChanged hack should work - perhaps you just need to figure out what you're doing that makes it crash?

yes it works...

for the crash, i'm getting random assert hits in juce::String (line 331) after i press keys on the keyboard and the keypresses are routed to the MidiKeyboardComponent. On linux btw.

I simply added this to the the PlugInEditor.cpp of the juce demo plugin:

bool JuceDemoPluginAudioProcessorEditor::keyStateChanged(bool isKeyDown) {
    return midiKeyboard.keyStateChanged(isKeyDown);

and it works for me on linux without crashing. Can you try and see if this works for you? If yes, then the mistake must be in a different part of your code.