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.
Regards,
Sergio
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
Sergio