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
 
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
Set ForceDone to False for all EditText views and True for the last ones in each column and use this code.
Code: Copy
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

Last edited:
Upvote 0
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
I had a look at your project.
The problem comes from these lines:
Code: Copy
r.Target = txtpassword
r.RunMethod2("setImeOptions", 0x10000000, "java.lang.int")
Setting this value resets the ForceDone flag.
Replacing it with this:
Code: Copy
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
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:
Code: Copy
r.Target = txtpassword
r.RunMethod2("setImeOptions", 0x10000000, "java.lang.int")
Setting this value resets the ForceDone flag.
Replacing it with this:
Code: Copy
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
Back
Top