Android Question how to set B4XFloatTextField max length

giannimaione

Well-Known Member
Licensed User
B4xFloatTextField is fantastic!

but how to set B4XFloatTextField max length ?

workaround, but this not like me!
B4X:
    B4XFloatTextField1.HintText="Type Here"
    B4XFloatTextField1.Tag=10 'max lenght
    B4XFloatTextField1.Update
and after
B4X:
Sub B4XFloatTextField1_TextChanged (Old As String, New As String)
    If New.Length > B4XFloatTextField1.Tag Then
        B4XFloatTextField1.Text = Old
    End If
End Sub
 

Erel

Administrator
Staff member
Licensed User
Better:
B4X:
If New.Length > B4XFloatTextField1.Tag Then
        B4XFloatTextField1.Text = New.Substring2(0, B4XFloatTextField1.Tag)
    End If
You can use IME.SetLengthFilter(B4XFloatTextField1.TextField)

Note that it will not work with password fields.
 
Top