unfocusAllComponents on textEditorReturnKeyPressed


EDIT: Posted wrong thing last time.

So the behavior I'm looking for is to unfocus, and return the value to the label after being in a textEditor and hitting the return key. I have a custom label class. I have tried adding the unfocus call inside the custom label class, and in the parent component and neither works. Here is what it looks like inside the parent component:


void TestProcessorEditor::editorShown (Label * l, TextEditor & ed){

void TestAudioProcessorEditor::editorHidden (Label * l, TextEditor & ed){

void TestAudioProcessorEditor::textEditorReturnKeyPressed (TextEditor & ed){

On top of that, I get a strange behavior where the first time I open the plugin window and change a value, then hit enter, the value does change, but not until the next timer callback. After the first time, it doesn't work anymore. I've debugged it and confirmed that unfocusAllComponents is in fact being called, but it doesn't do anything.


So making a custom label class, I made a new textEditorReturnKeyPressed method, and added a listener to the text editor. I finally figured out that this method is being called, but not when hitting the return key, it only gets called when you click out of the box to get focus on another object.


TextEditor* CustomLabel::createEditorComponent(){
    TextEditor* const ed = new TextEditor (getName());
    ed->applyFontToAllText (getLookAndFeel().getLabelFont (*this));
    copyAllExplicitColoursTo (*ed);
    copyColourIfSpecified (*this, *ed, textWhenEditingColourId, TextEditor::textColourId);
    copyColourIfSpecified (*this, *ed, backgroundWhenEditingColourId, TextEditor::backgroundColourId);
    copyColourIfSpecified (*this, *ed, outlineWhenEditingColourId, TextEditor::outlineColourId);
    return ed;

void CustomLabel::textEditorReturnKeyPressed (TextEditor & te){

Any help? I have no idea why this method doesn't get called when return is pressed.