Android Question Open the Standard Soft Keyboard to numbers.

MrKim

Well-Known Member
Licensed User
Longtime User
I am trying to use the new xui views library (B4XInputTemplate) and it appears the text box is a b4xview which does not have an inputtype property. So how do we control the Keyboard?

Currently I have this EKyBoard:
B4X:
ValueTxt.InputType = ValueTxt.INPUT_TYPE_TEXT
Which gives me this:


B4XInputTemplate
Gives me this:


I need to get rid of the line with Google, Sticker, GIF, Etc. and replace it with the Numbers row as above as in most cases (but not always) the entry will be numbers only.
This is a production floor application, making this stuff convenient for users is unacceptable.

Thanks for your help.
 

MrKim

Well-Known Member
Licensed User
Longtime User
Unless I am missing something I don't see how this helps. It gets me a numeric only keyboard but that is not what I am looking for (see first picture above).
I tried using dialog.ShowCustom but found a couple of issues with that. The code I have which you helped me with years ago which gives me the keyboard I want:
B4X:
    EdTxt.InputType = Bit.Or(128, Bit.Or(EdTxt.InputType, 524288)) 'VARIATION_PASSWORD, NO_SUGGESTION
doesn't work with B4XFloatTextField.
Also, the custom dialog doesn't open the keyboard automatically so I tried using IME to open the keyboard, but it too, doesn't work with B4XFloatTextField.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
EdTxt is a B4XFloatTextField?
B4X:
dim edttxt as edittext =EdTxt.Textfield
edttxt.InputType = ...
Should have been more clear, no edttxt is an Edittext. That was an example of the code that works with regular Edittexts but does not work with B4XFloatTextField.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
regular Edittexts but does not work with B4XFloatTextField
B4XFloatTextField is not a Edittext but it HAS a property Textfield which is the EditText you want

Asuming you B4XFloatTextField is named B4XFloatTextField1:

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private B4XFloatTextField1 As B4XFloatTextField
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    ' B4XFloatTextField1 is in the Layout
    Dim edtxt As EditText =B4XFloatTextField1.Textfield
    edtxt.InputType = Bit.Or(128, Bit.Or(edtxt.InputType, 524288)) 'VARIATION_PASSWORD, NO_SUGGESTION
End Sub
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
You are correct. I misread your post.

You can access the internal EditText with:
B4X:
Dim et As EditText = InputTemplate.TextField1
This works fine for the standard dialogs, but the custom dialog doesn't use InputTemplate. I am able to use GetAllViewsRecursive to access the views but it appears that properties like Hint and tag have been stripped of their values so I am unable to identify which view I am looking at.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…