Input type + another question

jschuchert

Active Member
Licensed User
Longtime User
I have set my text boxes to "NONE" as the input type so that the emulator's keypad doesn't obscure where data is entered. I don't have a device to check it on but wonder what a user will be able to do on their actual device under this scenario.

Would I be able to restrict the use of decimal numbers for an evaluation version by selecting "NUMBERS" as the input type? The emulator won't
allow decimal numbers. Will a device?

Last question:
B4X:
Dim x,y,aa As Double 
x=main.dblbch
y=dblhyp
[color=red]aa=x/y[/color]

txtclosure.Text =txtclosure.Text & " Perimeter Length = " & _
NumberFormat2(main.dblBch, 0,5,5,False) & CRLF & _
"Precision of closure = 1 in " & [color=red]x/y [/color]& CRLF <<<<<<< throws syntax error
"Precision of closure = 1 in " & [color=red]aa[/color] & CRLF <<<<<<<<this works
Why the difference?

Thank you.
Jim Schuchert
 

jschuchert

Active Member
Licensed User
Longtime User
Thank you but my main concern is what the user will be able to do for data entry if I have selected "NONE" for the input type from the designer. As soon I get a device (no-contract phone or tablet) I will be able to track these things but for now I can only rely upon the emulator. If NONE is the option, will that mean no keyboard will appear for the user? Naturally, I wouldn't want that. At this point I only use the designer (without code) for the input type and have noted no keyboard appears (emulator) with NONE selected but am able to use the right side of the emulator for input. Do you use a device for testing?

When I pick NUMBERS from the designer, I cannot enter decimals and that is what I could do in certain text boxes for an evaluation version but am not clear on whether or not an actual device can override it.

Incidentally, where would code like INPUT_TYPE_DECIMAL_NUMBERS be entered should I decide to do that? I really appreciate your help.

Jim
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I'm not clear on your problem but the emulator should be no different to an actual device.

I assume we are talking about EditText. To be able to enter signed decimals select Input Type - DECIMAL_NUMBERS in the designer or do it programmatically by

MyEditText.InputType = MyEditText.INPUT_TYPE_DECIMAL_NUMBERS
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
Ok, I believe you have answered my questions. Apparently the emulator is set up so that entries can be made regardless of the input type chosen. That's good for me for testing with the emulator but will have to make some adjustments (designer or code) before I release it to users with real devices. Thanks so much for your time.

Jim
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
B4X:
txtlength.Initialize ("txt") <<<<<<<< not sure about the event name
txtlength.InputType=txtlength.INPUT_TYPE_NUMBERS

Where would the code above be placed? Does it override whatever has been set in the designer? I put it in 'Sub Globala' but it doesn't pull up the keyboard when the cursor is in the edittext box as happens when set with the designer. Apparently it has to be initialized. Not clear what constitutes the 'event' name.

Jim
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
If the EditText is added by the designer you don't initialize it yourself, LoadLayout does that. You can only invoke methods on a View after it has been constructed which is after LoadLayout if it is declared in the designer or Initialize if not. Sub_Globals is not a good place for code. Events are covered in this tutorial.
 
Upvote 0
Top