How do I make a TextEdit require me to press the enter key to write text to it?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CatastrophicDInosaur

I want to make my UI as functional as possible, but when I use the built in focus tool it will automatically make it edit the text as it’s focused on it. Can I make it require a key press to edit the text?

:bust_in_silhouette: Reply From: Calinou

You can set the TextEdit’s readonly property to true until Enter has been pressed while the TextEdit is focused. When Enter is pressed, set readonly to false until the TextEdit loses focus.

However, note that this is not the expected behavior in most applications. In fact, if you try tabbing around form fields in your web browser, you’ll notice that you can start typing text as soon as a text field is focused with Tab.