giannimaione Well-Known Member Licensed User Longtime User Sep 20, 2019 #1 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
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 B4X founder Staff member Licensed User Longtime User Sep 22, 2019 #2 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. Upvote 0
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.