Private Sub TextArea1_TextChanged (Old As String, New As String)
If new.Length > 80 Then
TextArea1.text = old
TextArea1.setSelection(textarea1.text.length,textarea1.text.length) ' put the cursor at the end of the text
End If
End Sub
or
B4X:
Private Sub TextArea1_TextChanged (Old As String, New As String)
If new.Length > 80 Then
TextArea1.text = new.substring2(0,79)
TextArea1.setSelection(textarea1.text.length,textarea1.text.length) ' put the cursor at the end of the text
End If
End Sub
This is probably better as it can cope with pasting in lots of text.