[Textbox] Zero "0" number value problem!

(SVasco) #1

Hi:

I’m trying to detect when a zero “0” is typed in a textbox:
textBoxValue

Can be typed any number/letter in textbox!
But, for some reason, when the textbox as a zero “0” it does not detect it!

How can a zero “0” be detected when the user type 0 in it?

Thank you!

(Robert Crum) #2

Maybe you only want numbers in textbox…

(SVasco) #3

@Robert is a “Decimal number: 8” type!

I need it decimal. Example: 1.25

Problem is, when the user type 0 in the first place, the textbox.text should automatically changed to “0.”
… and for some reason is not working!

(Cian) #4

What @Robert is saying is use the blue blocks for a comparison . (math)

1 Like
#5

the green = and the blue = blocks are identical… see also the documentation…

@sergiovasco you might want to try the textbox extension and its AfterTextChagned event
Taifun

3 Likes
(Kanishka Chakraborty) #6

He means @sergiovasco should use a blue Math block for the 0, and not a Text block which signifies "0". It’s just a case of mixed types.

1 Like
#7

it is the same
Unbenannt
Taifun

3 Likes
(Kanishka Chakraborty) #8

It shouldn’t be, but since app inventor has no parseInt functionality, I can see why that is. The question remains, what caused the original problem?

1 Like
(Yusuf Cihan) #9

No, this is one of App Inventor’s features. :wink:

Thanks to App Inventor, variables and data types are different when compared to other programming languages.

Maybe you know, App Inventor doesn’t care about data types. So"0" is equal to 0, and it doesn’t need to convert it. Content in data is important, the data type is not important much in App Inventor.

By the way, @sergiovasco can you get the value of textBox by using Companion and “Do It” option? Your blocks are not wrong, but it I don’t know why this is not working.

1 Like
(Kanishka Chakraborty) #10

I know, and I utilize it to make syntaxial monsters impossible to create with other languages.

By “It shouldn’t be” I mean what App Inventor does isn’t optimal.

1 Like
(Yusuf Cihan) #11

Oh, sorry :sweat_smile: