how to eat return key

Avon

Member
Licensed User
Longtime User
I can catch the return key in an edit box, how do I consume it so that it doesn't send a CR to the edit box please?
 

kickaha

Well-Known Member
Licensed User
Longtime User
You can use the EditText.TextChanged event. This is called every time the text in the EditText box is changed so all you need to do is check for a CR in the new string, and if there is one revert back to the old string:

B4X:
MyEditBox.TextChanged (Old As String, New As String)
If New.Contains (CRLF) Then MyEditBox.Text = Old
Return

You will need to check the syntax for using CRLF, as I am not sure this is correct.
 
Upvote 0

Avon

Member
Licensed User
Longtime User
Diolch kickaha.

This must be one of the few things which is actually easier in Java!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…