How to get key strokes when the plugin window is selected in the host (without clicking on the component)


Sorry for bringing again this topic but I couldn’t figure out from old threads how to do this. See for example: Component focus without mouse click when Application launch

I know this should be possible because managed to implement it back in the day (props to thepiz!).

The issue is, I can grab the keyboard focus on the first repaint (as suggested in the thread above) but if the user clicks on another plugin window, and then back to my plugin window, I can’t find a way to get notified about it (focus is strangely not gained automatically in my AudioProcessorEditor) to be able to restore the keyboard focus.

Anybody can imagine what magic is thepiz using? Could it be a JUCE issue?


It shouldn’t be too hard. For example, doing the following changes to the JUCE demo plug-in works for me in Logic and Cubase:

… although it does trigger an odd crash when playing a few notes with the keyboard (which has nothing to do with the keyboard focus though). Need to investigate this!