TextEditor text Value - change whilst typing

Is there a proper way of getting the Value object to update every time the text editor is changed, rather than when focus is lost? If not, is this something that can be added?

I’ve managed to make it work by setting the onTextChange lambda to call getTextValue(), which updates the value internally. This is a bit hacky though and I feel like there should be a proper way to do this!

Bump! Anyone?

It’s possible to attach a listener that notifies every time the text changes:


Yeah I’m aware of that, but I have linked the Value object to a ValueTree property, which is a very neat & elegant solution, and so adding a listener, along with callback defeats the purpose of using the Value in the first place.

Sorry, i didn’t use the value tree for text editors so far. I see the advantages, especially for Undo / Redo operations. Did you wrote your own TextEditorAttachment or how do you bind it to the tree?

No need to write an attachment, you can just use the following line:

    filterTextBox.getTextValue ().referTo (tree.getPropertyAsValue ("currentFilter", nullptr));