Rusty Well-Known Member Licensed User Longtime User Mar 16, 2019 #1 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
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
E emexes Expert Licensed User Longtime User Mar 16, 2019 #2 Rusty said: 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. Click to expand... 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 ;-) Code: Copy 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 Upvote 0
Rusty said: 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. Click to expand... 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 ;-) Code: Copy 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
E emexes Expert Licensed User Longtime User Mar 16, 2019 #3 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. Upvote 0
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.
Rusty Well-Known Member Licensed User Longtime User Mar 19, 2019 #4 Thanks Emexes, I found the solution HERE Upvote 0