I'm working on a plugin using juce 3.0.1 (AAX version at present) that allows keyboard input into value fields that we want to prevent from assigning keyboard focus to any controls after editing so that all ProTools key commands work after edits are made.
I first tried calling setWantsKeyboardFocus(false) on all the controls in my component and setFocusContainer(false) on the component containing the controls, but the tab key still gives those controls focus. I then created this custom KeyboardFocusTraverser class:
class KeyboardFocusController : public KeyboardFocusTraverser
{
public:
juce::Component* getNextComponent(juce::Component* current) { return NULL; }
juce::Component* getPreviousComponent(juce::Component* current) { return NULL; }
juce::Component* getDefaultComponent(juce::Component* parent) { return NULL; }
};
This almost does exactly what I need, except that after completing an edit in a TextEditor control, keyboard focus jumps to one of the ComboBox controls, which then responds to the cursor and Enter keystrokes rather than passing them to ProTools. It acts the same whether the edit field is completed with either the tab or enter key. The tab key now is passed to the host unless a TextEditor control is active (it accepts the edit then which is the behavior I'm looking for) but I haven't found a way to prevent the ComboBox from gaining focus, which prevents the Enter key from being passed to the host.
Is there something special about ComboBox controls and key focus, and does anyone have ideas how to get around this?
Thanks!
-
rundio
