Android Question b4xfloattextfield keyboard type change at runtime

Rusty

Well-Known Member
Licensed User
Can you change a b4xFloatTextField input/keyboard type at runtime.
I'd like to use the same view for both numeric and text, but set the keyboard upon display.
Thanks,
Rusty
 

emexes

Expert
Licensed User
Can you change a b4xFloatTextField input/keyboard type at runtime.
I'd like to use the same view for both numeric and text, but set the keyboard upon display.
This is only half-an-answer, because I am in the middle of a project and haven't been game to update my B4A to the B4XLIB level, but... it used to work, and I would expect that the XUI library would be similarly capable.

(with the proviso that: when you say "set the keyboard upon display", presumably you mean display of the field, not display of the keyboard... changing the keyboard after it is displayed sounds like a much more ambitious affair ;-)

B4X:
Dim InputField As EditText

InputField.Text = VariableContainingExistingFieldData

If IsNumber(InputField.Text) Then
    InputField.InputType = InputField.INPUT_TYPE_DECIMAL_NUMBERS
Else
    InputField.InputType = InputField.INPUT_TYPE_TEXT
End If
 

emexes

Expert
Licensed User
I should add that: from memory, IsNumber("") = False, which is likely to be what you want, but... something to think about.

Eg. if the initial field is blank, you might initialize it to a default or sample entry.
 
Top