semar Active Member Licensed User Longtime User Sep 17, 2017 #1 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. Code: Copy 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
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. Code: Copy 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
Erel B4X founder Staff member Licensed User Longtime User Sep 18, 2017 #2 Why are you using TextView (multiline) instead of TextField (single line) ? Upvote 0
semar Active Member Licensed User Longtime User Sep 18, 2017 #3 Why are you using TextView (multiline) instead of TextField (single line) ? Click to expand... 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
Why are you using TextView (multiline) instead of TextField (single line) ? Click to expand... 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