Force NEXT on keyboard

davelew1s

Active Member
Licensed User
Longtime User
Hi! How can I force NEXT on the keyboard...I have 4 edittex boxes all with the same properties (force done = false except the last one) but when the app is run the keyboard only shows DONE.
Thanks Dave.
 

b4AMarkO

Member
Licensed User
Longtime User
You can force it with this code:
B4X:
Sub ForceNext(et As EditText)
 Dim r As Reflector
 r.Target = et
 r.RunMethod2("setImeOptions", 5, "java.lang.int")
End Sub

Erel I am facing this problem .... question after adding the Sub ForceNext
Where do I make the call .... in the EditText FocusChanged or?
Or am I looking at this wrong?
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Suppose you have a few edittext views sharing the same event name: txtBoxes, you can have something like this:
B4X:
Sub txtBoxes_FocusChanged(Hasfocus As Boolean)
      Dim Send As EditText
      Send=Sender
      If Hasfocus Then ForceNext(Send)
End Sub

Sub ForceNext(et As EditText)
 Dim r As Reflector
 r.Target = et
 r.RunMethod2("setImeOptions", 5, "java.lang.int")
End Sub
 
Upvote 0

b4AMarkO

Member
Licensed User
Longtime User
B4X:
Dim Send As EditText
      Send=Sender
If Hasfocus Then ForceNext(Send)

I have the above code in etColor_FocusChanged to test it

It worked sort of ....... did as usual said done on KeyBoard but if I touched one of the EditText then I could tab through them and they all did the Next allowing me to tab so I am not sure whay it didnt catch it ..... but I am looking through it now
 
Last edited:
Upvote 0

b4AMarkO

Member
Licensed User
Longtime User
Ive used it this way

B4X:
Sub ForceNext(et As EditText)
     Dim r As Reflector
     r.Target = et
     r.RunMethod2("setImeOptions", 5, "java.lang.int")
End Sub
Sub txtBoxes_FocusChanged(Hasfocus As Boolean)
        Dim Send As EditText
        Send=Sender
      
        If Hasfocus Then 
         Send.SelectionStart = Send.Text.Length
         Send.SelectAll 
         ForceNext(Send)
      End If
      
End Sub

However I tried without adding the Send.Selectionstart ect ect ect

Doesnt matter on first try it doesnt work ... its almost as if the etColor etBLD etLot dont have Focus but
If I select etTag (first editi text) then Tab through it works through all until
I get to the last three
Note all share the same event name txtBoxes

So any ideas?
 
Upvote 0

grupotgr

Member
Licensed User
Longtime User
hello, I want to force next to an EditText that is the last of the activity but only I get OK.
I have edittext1, edittext2, edittext3, edittext4.
1, 2 and 3 works perfect with forcenext, but edittext4 the last does not work.
unless there add another EditText and if it works.
I can fix this in some way?

SORRY FOR MY BAD ENGLISH!

Thank you very much.
Regards
 
Upvote 0
Top