Convert TextFieldText to Int?

BlitzMax Forums/BlitzMax Beginners Area/Convert TextFieldText to Int?

bookworm99(Posted 2008) [#1]
Hi all...

Once again, I've kinda hit a wall in my coding. What I want to do is convert text from a textfield into an int and update the int as different numbers are entered into the field. I've tried using Int() to get that working, but it doesn't seem to work or to be updated.

Any help anyone has is appreciated greatly!


tonyg(Posted 2008) [#2]
Is this what you're after :
SuperStrict
Import maxgui.drivers 'If you use the SVN version of MaxGUI. Comment it out if you don't
Local MyWindow:TGadget=CreateWindow("TextField Example", 200,200,320,240)
Local Label0:TGadget=CreateLabel("Number:",10,10,100,20,MyWindow)
Local Label1:TGadget=CreateLabel("You have keyed in:",10,40,200,40,MyWindow)

Local MyInput:TGadget=CreateTextField(110,10,180,20,MyWindow)


Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
  Case EVENT_GADGETACTION
	Local textin:String=TextFieldText(MyInput)
	Local int_text:Int=Int(textin)
    SetGadgetText(Label1,"You have keyed in:"+ int_text)
   End Select
Forever