iOS Question TextView and Return Key on the Keyboard

semar

Active Member
Licensed User
Longtime User
Hi all,
I have a TextView - txt_InputGuess in the example - and I don't know how to check if the user is done with the input. In fact, when the Return key is pressed on the keyboard, a new line is added to the TextView, and no "End Edit" event is generated.

I can check if the input text contains a carriage return, and if true, I hide the keyboard and get the latest entered text without the carriage return - Chr(10). And thanks to the ResignFocus method, the EndEdit method will also be fired - so far so good.

However, while this workaround works, I wonder if there is a properly way to check if the user is done with the input.
B4X:
Sub txt_InputGuess_TextChanged (OldText As String, NewText As String)
   If NewText.Contains(Chr(10)) Then 'return key was pressed
     txt_InputGuess.Text = OldText
     txt_InputGuess.ResignFocus
   End If
End Sub
Regards,
Sergio
 

semar

Active Member
Licensed User
Longtime User
Why are you using TextView (multiline) instead of TextField (single line) ?
A good question ! Basically I had a .bal converted in a .bil with the converter, but the compiler complained, that a TextField found where it has a TextView expected.
So I guessed that the TextField is not supported..
I'll dig into it. Thanks for your reply
 
Upvote 0
Top