I have a problem! I want to assign ONLY a number to a variable, in realtime, without an error being generated, as I'm typing.
- the TextChanged event(s) of an textedit box, needs to be able to accept anything you can throw at it from the android numeric keyboard without causing an error due to assigning the input to a float or double-type variable as you're typing a number.
- The input MIGHT start with a minus sign. But! That's not a number when you start anything with a minus sign. So there will be an error, right? I tried this with a try/catch and tried with isnumeric. Can't figure this out. Also, a "null" or EMPTY value, can't cause an error either. And neither should the beginning of what you type, cause and error starting your input with a decimal point, a minus AND decimal point, or any combination of thereof. What to do?
Sub EditText1_TextChanged (Old As String, New As String)
If New = "" OR New = "-" OR New = "." OR New = "-." OR IsNumber(New) Then Return
Msgbox("error in input "&New,"Input error")
EditText1.Text=Old
End Sub
Is this any better?
B4X:Sub EditText1_TextChanged (Old As String, New As String) If New = "" OR New = "-" OR New = "." OR New = "-." OR IsNumber(New) Then Return Msgbox("error in input "&New,"Input error") EditText1.Text=Old End Sub
Looks like I'm going to have to learn Java in the final analysis of this whole thing!
If you're lost with Basic4Android, then that will be worse with Java. IMHO, there are two important things to learn:
- object-oriented programming and event-driven programming;
- Android life cycle.
If you understand well these two things, you're ready to program with B4A. Learning the language itself is not the main difficulty.
Coherent documentation is what is needed.
Which language does B4A match exactly? I know it doesn't match the Basic language.
For instance, the "label:" command. There's no label command that allows you to jump to a specific LINE in the old style spagetti-code fashion? I'm STILL not proficient in anything!
Ahhhhhhhhh. A sigh of relief. Thank you so much.
BTW Steve, where can I actually LEARN everything there is to learn B4A programming, in a linear, tutorial-type fashion? I'm not really seeing that it is possible to truly learn programming B4A, from beginning to end, since it would seem to me that the docs are completely spread out, and not really focusing on exactly, how to program in this langauge?
I purchased the brand new and one-and-only B4A book, and quite frankly, though it is an improvement, it is NOT a B4A programming tutorial by any stretch of the imagination. Kind of a waste of money.
Which language does B4A match exactly? I know it doesn't match the Basic language.
For instance, the "label:" command. There's no label command that allows you to jump to a specific LINE in the old style spagetti-code fashion? I'm STILL not proficient in anything!
Looks like I'm going to have to learn Java in the final analysis of this whole thing!
Marsh
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?