steinbergmedia / vstgui

A user interface toolkit mainly for audio plug-ins
Other
880 stars 124 forks source link

On TextEdits, Enter acts as Return #299

Closed redtide closed 1 year ago

redtide commented 1 year ago

I hope it's fine if EditorConfig did his job to remove trailing spaces for this small addition

scheffle commented 1 year ago

This change is a breaking change of the behaviour of the text edit field. There are use cases where the Enter key should not close the text edit field. Please add a listener on your instances of the text edit field and handle the Enter key there.

redtide commented 1 year ago

is there any example on how to use a ITextEditListener? I thought it was as simple as subclass and override onKeyboardEvent().

scheffle commented 1 year ago

You need to implement an IViewEventListener and register this listener with your text edit control. In this event listener you only check for EventType::KeyDown, cast this event to a KeyboardEvent via castKeyboardEvent and then you can check the KeyboardEvent if it is the ENTER key.

redtide commented 1 year ago

Thank you.