I Inman Well-Known Member Licensed User Longtime User Jul 5, 2020 #1 I am using the following code to declare an EditText and display a Search icon instead of Done button B4X: txtname.Initialize("txtname") txtname.Hint="Product" txtname.SingleLine=True Activity.AddView(txtname,10dip,lblline.Top+lblline.Height+5dip,100%x-20dip,48dip) Dim JO As JavaObject = txtname JO.RunMethod("setImeOptions",Array As Object(3)) Now to capture search button B4X: Sub txtname_EnterPressed Log(txtname.Text) End Sub Problem is every time I type something into the textbox and hit search icon on keyboard, the log prints it twice. Which means the EnterPressed event is getting raised twice. If I remove the javaobject code that shows search icon, EnterPressed works fine as it gets raised only once. But if I display search icon, the event is raised twice. Any idea how to fix this?
I am using the following code to declare an EditText and display a Search icon instead of Done button B4X: txtname.Initialize("txtname") txtname.Hint="Product" txtname.SingleLine=True Activity.AddView(txtname,10dip,lblline.Top+lblline.Height+5dip,100%x-20dip,48dip) Dim JO As JavaObject = txtname JO.RunMethod("setImeOptions",Array As Object(3)) Now to capture search button B4X: Sub txtname_EnterPressed Log(txtname.Text) End Sub Problem is every time I type something into the textbox and hit search icon on keyboard, the log prints it twice. Which means the EnterPressed event is getting raised twice. If I remove the javaobject code that shows search icon, EnterPressed works fine as it gets raised only once. But if I display search icon, the event is raised twice. Any idea how to fix this?
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2020 #2 Please upload a small project with this code. Upvote 0
I Inman Well-Known Member Licensed User Longtime User Jul 7, 2020 #3 I will try to upload over the weekend. Fortunately the client's requirement changed and so displaying search icon is no longer needed. Upvote 0
I will try to upload over the weekend. Fortunately the client's requirement changed and so displaying search icon is no longer needed.