Capture the Enter Key?

I am trying to make a simple app that will take typed text and using system.speak send out voice. I have a “send” button that does this OK, I would like to also capture the Enter key. It should be a simple thing to capture the Enter key…..

In KeyDown on a TextField

If Key = Chr(13) Then
System.Speak(TextField1.Text)
TextArea1.AddText(TextField1.text + EndOfLine)
TextField1.text= “”

’ Set the cursor back to the input field
TextField1.SetFocus
Return True
Else
Return False
End If

Well, that doesn’t work. In debug, I can only see printing characters, so if it is trapping on Chr(13) I don’t see it.

I saw a similar post from 5 years ago and what is supposed to work is what I have here, however No Joy. This app is for a friend that has can’t speak after cancer surgery. I want to connect this app to his Ham Radio so that he can get back on the air.

Suggestions?

Bob N4RFC

More information would help

OS?

Xojo Verion?

Try Chr(4) for the Enter key. Confirm with the documentation (its late here).

2025r2.1

I would make the text area single line and set the speak button to be the default button so it captures Enter and Return by itself.

1 Like

Eric,

That’s a good idea. And I had a miracle here. I shut it down, went and had some dinner, came back brought the program up and it worked. Don’t know what was going on, but it worked and my friend used it this evening to talk to our buddies.
Thanks for the input.

Regards,

Bob N4RFC

Almost. That would be 3.

1 Like