cooperlegend Active Member Licensed User Longtime User Jan 6, 2015 #1 I have tried using TextChanged as below (This worked fine in B4A) B4X: Sub txtPasscode_TextChanged (OldText As String, NewText As String) If NewText.Length > 6 Then txtPasscode.Text = OldText End If End Sub But this doesn't work in b4i. Currently I have to truncate using EndEdit, but I would prefer to limit the user to inputting no more than 6 characters. Any Ideas?
I have tried using TextChanged as below (This worked fine in B4A) B4X: Sub txtPasscode_TextChanged (OldText As String, NewText As String) If NewText.Length > 6 Then txtPasscode.Text = OldText End If End Sub But this doesn't work in b4i. Currently I have to truncate using EndEdit, but I would prefer to limit the user to inputting no more than 6 characters. Any Ideas?
Erel B4X founder Staff member Licensed User Longtime User Jan 6, 2015 #2 Try: txtPasscode.Text = NewText.SubString2(0, 6) Upvote 0
cooperlegend Active Member Licensed User Longtime User Jan 6, 2015 #3 That almost works, it at first allows and shows the 7th character, then when you enter another character it then truncates back to 6 (correctly) ?!?? Quite strange... Upvote 0
That almost works, it at first allows and shows the 7th character, then when you enter another character it then truncates back to 6 (correctly) ?!?? Quite strange...