[RESOLVED] Trapping key presses in plugin?

I can’t seem to get any key presses in my plugin. I have tested (on the Mac) in Studio One, Cubase and Pro Tools, but none of them give me key presses except in my text fields (Labels). What I’m doing may not be kosher in most DAWs, however. I’m trying to trap Escape, Backspace, Delete, the top row of numeric keys, and several Command-key combinations (A, Z, Y, C, X and V). But they all go straight to the host, and my Editor’s KeyPressed() function is never called. I have added this code (when switching to a mode where I want these key presses):

this->setWantsKeyboardFocus( true );
this->setFocusContainer( true );

…but none of those seems to help. I don’t want to restrict getting keypresses to only when I click on a component that wants them (such as a Label). (Clicking on my plugin window, anyplace, does not help. But my Editor is completely covered by sub-Components, so I don’t know if those are interfering somehow?)

These all work in my non-JUCE plugins, but not in my JUCE plugins. How can I get key presses at the Editor level, so that I can distribute the actions I need to take to the various sub-components that can take those actions? Do I need to use something other than a KeyListener (which my Editor has as one of its base class)?


Ok, that was my fault. I called addMouseListener instead of addKeyListener. D’oh! :smiley: