pfhrr Member Licensed User Longtime User May 30, 2015 #1 I have code that has three edittext views. With soft keyboard after entering text in EditText3, when Finished is pressed the code executes as expected; all text is cleared focus shifts to EditText1. With a Bluetooth connected external hard keyboard after entering text in EditText3, when Return is pressed the following occurs; all text is cleared focus shifts to EditText1 briefly then focus shifts to EditTest2 Sub EditText3_EnterPressed EditText1.Text = "" ' clear input EditText2.Text = "" ' clear input EditText3.Text = "" ' clear input EditText1.RequestFocus ' shift focus back to first EditText view End Sub Attachments testExtKeyBoard.zip testExtKeyBoard.zip 7.2 KB · Views: 505
I have code that has three edittext views. With soft keyboard after entering text in EditText3, when Finished is pressed the code executes as expected; all text is cleared focus shifts to EditText1. With a Bluetooth connected external hard keyboard after entering text in EditText3, when Return is pressed the following occurs; all text is cleared focus shifts to EditText1 briefly then focus shifts to EditTest2 Sub EditText3_EnterPressed EditText1.Text = "" ' clear input EditText2.Text = "" ' clear input EditText3.Text = "" ' clear input EditText1.RequestFocus ' shift focus back to first EditText view End Sub
Erel B4X founder Staff member Licensed User Longtime User May 31, 2015 #2 Try this: Code: Copy Sub MoveFocus EditText1.RequestFocus End Sub Sub EditText3_EnterPressed EditText1.Text = "" ' clear input EditText2.Text = "" ' clear input EditText3.Text = "" ' clear input CallSubDelayed(Me, "MoveFocus") End Sub Upvote 0
Try this: Code: Copy Sub MoveFocus EditText1.RequestFocus End Sub Sub EditText3_EnterPressed EditText1.Text = "" ' clear input EditText2.Text = "" ' clear input EditText3.Text = "" ' clear input CallSubDelayed(Me, "MoveFocus") End Sub
pfhrr Member Licensed User Longtime User Jun 1, 2015 #3 Thanks Erel I tried your code but still get the same result - focus moves to EditText1.Text with soft keyboard, but focus moves to EditText1.Text briefly then EditText2.Text with external keyboard. Upvote 0
Thanks Erel I tried your code but still get the same result - focus moves to EditText1.Text with soft keyboard, but focus moves to EditText1.Text briefly then EditText2.Text with external keyboard.
Erel B4X founder Staff member Licensed User Longtime User Jun 1, 2015 #4 Use HandleAction event instead of the EnterPressed: https://www.b4x.com/android/forum/t...-keyboard-with-the-ime-library.14832/#content Upvote 0
Use HandleAction event instead of the EnterPressed: https://www.b4x.com/android/forum/t...-keyboard-with-the-ime-library.14832/#content