B4J Question _TextChanged

JTmartins

Active Member
Licensed User
Longtime User
I was trying to do a fancy thing. Not important but helpfull and came across a problem.

I have a text field where all input is always in the format XX-XX-XX

So I tryed this in order to add the "-" automaticaly

B4X:
Sub edtMatricula_TextChanged (Old As String, New As String)
    If edtMatricula.Text.Length=2 OR edtMatricula.Text.Length=5 Then
        edtMatricula.Text=edtMatricula.Text&"-"     
    End If
End Sub

It does work partially. The problem is that after the "-" is inserted by the routine the cursor reverts to the begining of the field and the user has to move the cursor to continue typing in the proper place.

I tryed some variations of the above...but always the same result.

Any ideas of how to implement this ?
 

JTmartins

Active Member
Licensed User
Longtime User
Ah ah...perfect as usual Erel.

If there was a Nobel prize for support, you would get it in a blink of an eye.:)
 
Upvote 0
Top