Android Question edittext order

tufanv

Expert
Licensed User
Longtime User
hello,

I made a research on the forum but could only find a fileorder lib but it does not make the job. I have 6 edittexts. 2 on the left 4 on the right . Below 2 edittexts in the left there is a button and below 4 edittexts on the right there is a button too.

When i try with the first on the left it always show next button until the end of 6 edittexts but i want to make it display done on the keyboard after second editbox on the left and for the right side after the last one. I tried to activate force done but it didnt help. Can anyone help
ty
 

mangojack

Expert
Licensed User
Longtime User
Have you seen this class by Stevel05 .. EditText Field Order ...

maybe declare your EditTexts into 2 groups. Have not tried so unsure whether it will solve your problem.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Set ForceDone to False for all EditText views and True for the last ones in each column and use this code.
B4X:
Sub edtTest11_EnterPressed
    CallSubDelayed2(Me, "SetFocus", edtTest12)
End Sub

Sub edtTest21_EnterPressed
    CallSubDelayed2(Me, "SetFocus", edtTest22)
End Sub

Sub edtTest22_EnterPressed
    CallSubDelayed2(Me, "SetFocus", edtTest23)
End Sub

Sub edtTest23_EnterPressed
    CallSubDelayed2(Me, "SetFocus", edtTest24)
End Sub

Sub SetFocus(edt As EditText)
    edt.RequestFocus
End Sub

Attached a demo program.
 

Attachments

  • EditTextOrder.zip
    7.4 KB · Views: 148
Last edited:
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Dear Klaus,

Thank you very much for your help. When I run your app it works perfect. But i did the same thing in my app divided the panel into two panels. in the left panel i have 2 editboxs in the right panel i have 4 . i copied the code to my app but after the last textbox on the left it doesnot display done( i have edited the last ones as force done true others false) it displays next and when i hit it it jumps to 2nd edittext on the right :/
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I had a look at your project.
The problem comes from these lines:
B4X:
r.Target = txtpassword
r.RunMethod2("setImeOptions", 0x10000000, "java.lang.int")
Setting this value resets the ForceDone flag.
Replacing it with this:
B4X:
r.Target = txtpassword
r.RunMethod2("setImeOptions", 0x10000006, "java.lang.int")
The 6 at the end means IME_ACTION_DONE.
You should also set 0x10000006 for txtbase.

If you are targetting API level >= 11 then you might replace
0x10000000 by 0x02000000
and
0x10000006 by 0x02000006
 
Last edited:
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Klaus You are awesome ! Ty very much. it is done now !
It would take about 10 years for me to find out :)
TY again

I had a look at your project.
The problem comes from these lines:
B4X:
r.Target = txtpassword
r.RunMethod2("setImeOptions", 0x10000000, "java.lang.int")
Setting this value resets the ForceDone flag.
Replacing it with this:
B4X:
r.Target = txtpassword
r.RunMethod2("setImeOptions", 0x10000006, "java.lang.int")
The 6 at the end means IME_ACTION_DONE.
You should also set 0x10000006 for txtbase.
 
Upvote 0
Top