Hi, I don't know if like me, you also noticed that by using floattextfield in B4J, we don't know how to adapt the following code to obtain the capital letter obligatorily
B4J FloatTextField ToUppercase capital:
B4J FloatTextField ToUppercase Majuscule:
'Dim bxf As B4XFloatTextField
' bxf is the FloatTextfield.
Dim edtfield As EditText = bxf.TextField
edtfield.InputType = edtfield.INPUT_TYPE_PHONE
This class contains constants for all of the available inputtypes as defined on Android Developers except TYPE_TEXT_FLAG_AUTO_COMPLETE, which would require a Java library to be of any use, but we have other options to do this anyway. It also provides a method to update the values associated...
how to add input type to edtfield in order to successfully do:
B4J FloatTextField ToUppercase capital:
Dim Bxf As B4XFloatTextField
'Bxf is the FloatTextfield.
Dim edtfield As TextField = Bxf.TextField
edtfield.InputType = edtfield.TYPE_TEXT_FLAG_CAP_CHARACTERS
I thought I'd try it just to see and it seems to work OK.
B4X:
'After loadlayout:
Dim tfToUpper As TextFormatter
tfToUpper.Initialize(Me,"ToUpperCase",tfUpperCase) ' Or whatever your textfield is called.'
'And add the callback sub
Sub ToUpperCase_TextValidator(Change As TFChange) As TFChange
'Force to UpperCase
Change.Text = Change.Text.ToUpperCase
Return Change
End Sub