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

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

like here in this example from DonManFred

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

How to solve this problem?
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Upvote 0

YPMN

Member
Licensed User
Longtime User
After adapting the code, the last line gives me a problem. How to implement this capital constant please?

B4J FloatTextField ToUppercase capital:
Dim Bxf As B4XFloatTextField
' Bxf is the FloatTextfield.
Dim edtfield As TextField = Bxf.TextField
edtfield.InputType = edtfield.TYPE_CLASS_TEXT

Help!
 
Upvote 0

YPMN

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

stevel05

Expert
Licensed User
Longtime User
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
 
Last edited:
Upvote 0
Top