Advancing to next edittext on Enter

boastrike

Member
Licensed User
Longtime User
I have a simple app that has two edittext fields. Upon entering valid data into the first edittext and pressing enter, I want it to go to the second edittext that is in a panel that I set visible true in the edittext1_EnterPressed sub.

I am setting the txtQuantity.RequestFocus in this sub. In designer I have set both of the fields ForceDone to true as well.

PnlQty.Visible = True
gbItem = txtItem.Text
txtQuantity.RequestFocus

When I run it in emulator/debug mode and step through it line by line, it works exactly as I expect and makes the panel visible and sets the focus in the edittext2 field but when I remove the debug stops and run it, the app skips right past the second edittext field and ends up setting focus on a button I have at the bottom of the active screen that is to be used when they are done looping through the first two fields.

Any suggestions?

Thanks!
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
This is just a hunch, but you might try this:

B4X:
Sub edittext1_EnterPressed
    ...
    Timer1.Enabled
End Sub

Sub Timer1_Tick
    PnlQty.Visible = True
    gbItem = txtItem.Text
    txtQuantity.RequestFocus
End Sub
 
Upvote 0

boastrike

Member
Licensed User
Longtime User
nfordbscndrd,

Thanks for the suggestion. I believe I see where your logic is coming from and did try it. It didn't solve the issue though. It did act erratic and sometimes worked when I used "100" for the time value but most often just put the panel up on the screen and auto-advanced itself to the button. Just like the item field, when I would press enter after entering the quantity, it would sometimes take the logic and add it to the listview and reset to the item field and sometimes just set focus to the listview. Again, stepping through in debug works as it should.

Thanks for the idea though.

Jim
 
Upvote 0
Top