Bug with TextEditor return key press?


#1

Hey Jules
When entering text into a TextEditor component and pressing the return key the textEditorReturnKeyPressed() function is being called but the component isn’t losing focus as I would expect it to.
Is this a bug, or should I be manually calling something else within textEditorReturnKeyPressed() to lose focus?
I have set ReturnKeyStartsNewLine to false.

Thanks.


#2

Why would you expect it to lose focus when you press return?


#3

To give visual feedback to the user than the text has been successfully entered. Otherwise it could look like the return key isn’t actually doing anything.
It works fine with Juce labels that are set to editable.

Isn’t that kind of interaction fairly common to text box objects within software interfaces?


#4

Well, you will obviously see that happen in a lot of UIs, but it’s not the TextEditor’s responsibility to move the focus for you! If you’re responding to the return key, then just do whatever is appropriate for your app.