TextEditor loses focus on return key in Studio One

Hi all,

I’m creating a plugin in which I use a TextEditor to capture some notes of a user.
Problem is that, whatever I try, the plug-in seems to lose focus when the return key is pressed.
In the AudioPluginHost the problem does not occur; you just go to the next line like desired.
However in Studio One the plug-in just gives away focus (OnFocusLost is called).

The settings on the TextEditor:
afbeelding

Does anybody know a solution to this problem???

Regards,
Kev

I have encountered the same problem.
I am using JUCE v7.0.8.
I have confirmed that this problem only occurs in Studio One on Windows and not in Studio One on macOS, Cubase, Logic Pro or GarageBand.
When I type Japanese or Chinese, I have to press the return key to confirm the input, but each time I confirm the input, it loses focus and becomes difficult to operate.
Is there a solution?

I solved the problem by using an inherited TextEditor class as shown below.

class CustomTextEditor : public TextEditor {
   public:
    CustomTextEditor() : TextEditor() {}
    virtual ~CustomTextEditor() {}

    void focusGained(FocusChangeType) override { enterModalState(false); }
    void inputAttemptWhenModal() override { exitModalState(); }
};
1 Like

This problem is because the keyup for the return key is returning handled as false, which passes control back to the DAW (Studio One). S1 then sees it wasn’t used and uses it to take focus back to itself, which I think is reasonable for it to do. Arguably this is a Juce bug.

In a mouse-driven plugin you lead with a click first to get to say a slider or knob’s text value entry, so that re-focuses the plugin and works itself out since no further text input is required until the next click to re-focus. But this doesn’t work for more extensive keyboard entry plugins since the focus is thrown. Although this is just in S1 Win, it could end up happening elsewhere and for other keys that are not consumed by the plugin.

To solve I modified the Juce source doKeyUp with the following:

bool doKeyUp (const WPARAM key)
{
    updateKeyModifiers();

    switch (key)
    {
        case VK_RETURN:
            return true; // Modification to return true for return key

I couldn’t find a nice way of solving. A KeyListener using onKeyStateChange() has the limitation of that method not supplying the key of the key up or down (please vote this up). And for component overriding a TextEditor, well some TextEditors inside e.g. Slider controls are inaccessible.