GadgetText:String() beginner question

BlitzMax Forums/MaxGUI Module/GadgetText:String() beginner question

Galdy(Posted 2016) [#1]
I only need an integer value out of the text field, but it will only pass a string. Is there a way can I do this?


Value = GadgetText:String(Level1_Width1_Input)


Galdy(Posted 2016) [#2]
Ok nevermind. I figured how to cast the string to an integer.


degac(Posted 2016) [#3]
edit: too late ;)


Value=Int(GadgetText(level1_width1_input))


Basically GadgetText returns a string. Then you can cast it to whatever.

ps:

'converting' a string number in a number depends on the way you write/type it (in italian we use comma to separates integers and decimals, in other nations the 'dot' and so on)
So - the string from the button - should be checked depending on the result you want.




Galdy(Posted 2016) [#4]
Thanks for the reply. Yes it's a dot for me. I noticed it can be cast to a float as well so that I can enter decimal fractions.


Bobysait(Posted 2016) [#5]
Just a small reminder : the string type has its own conversion

-> MyString.ToInt() / ToFloat() / ToLong() / ToDouble()