I have a TextArea in a modal window. When I click the Enter key to insert a paragraph return, the window closes. How do I prevent this?
Can you share an example? I tried to replicate what you wrote but I can’t, I can click the Enter key and insert a paragraph return, don’t know what I’m missing.
You probably have a button to close the window? Is that button set to Default?
That’s it Bob. I have 2 buttons - Cancel & Save, both were set to default. Unchecked both and no problem.
I looked in documentation to find the meaning of the various properties of controls in the Inspector, but I can’t find anything?
A Default button uses the Enter key as shortcut to press it. On MacOS this will have a blue highlight and you should never have more than one default button.
The Cancel button will use the Escape key as a shortcut to press it.
Weird, the only way I can replicate this by adding a default button is to set TextArea Multiline to False. If I have multiline, then pressing Enter key will add a line in the TextArea and will not click the Default button.
Because the cancel button was set to default and the action was Self.Close
I added 2 buttons, Ok and Cancel, both default, both with action Self.Close, if I have TextArea as multiline, I can press enter and it works correctly (new line and window stay open). I don’t know what I’m doing different than you.
Glad your code is working now.
Is there a way I can upload a sample project here so you can see it?
If you have Dropbox you can post a link to share your file. Or upload to other sharing site and post the link.
See if this link works:
It behaves the same as my test.
Tested on macOS 10.12.6 hardware, macOS 10.14.5 VM, Windows 10 VM and Windows 7 VM.
I don’t understand why, when you press return the window closes and for me it puts a new line in textarea. Sorry.
I’m using Windows 10. Oh well. At least I know how to resolve it now.