B4J Question Require capitalization for FloatTextField in B4J

YPMN

Member
Licensed User
Longtime User
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

Code: Copy
B4J FloatTextField ToUppercase Majuscule:
'Dim bxf As B4XFloatTextField
    ' bxf is the FloatTextfield.
    Dim edtfield As EditText = bxf.TextField
    edtfield.InputType = edtfield.INPUT_TYPE_PHONE

like here in this example from DonManFred

https://www.b4x.com/android/forum/threads/b4xfloattextfield-with-inputtype.133589/

How to solve this problem?
 
Upvote 0
After adapting the code, the last line gives me a problem. How to implement this capital constant please?

Code: Copy
Dim Bxf As B4XFloatTextField
' Bxf is the FloatTextfield.
Dim edtfield As TextField = Bxf.TextField
edtfield.InputType = edtfield.TYPE_CLASS_TEXT

Help!
 
Upvote 0
how to add input type to edtfield in order to successfully do:

Code: Copy
Dim Bxf As B4XFloatTextField
'Bxf is the FloatTextfield.
Dim edtfield As TextField = Bxf.TextField
edtfield.InputType = edtfield.TYPE_TEXT_FLAG_CAP_CHARACTERS
 
Upvote 0
I thought I'd try it just to see and it seems to work OK.

B4X: Copy
'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
 
Last edited:
Upvote 0
Back
Top