Numerical data Only?

BlitzMax Forums/BlitzMax Beginners Area/Numerical data Only?

I want to grab textfieldtext currently inputed but only want to accept it if it is numerical.

Can someone show me how to do this?

Thanks :)

SuperStrict

Global mainWin:TGadget = CreateWindow("Main" , 0 , 0 , 400 , 400)
Global ta:TGadget = CreateTextArea(10 , 10 , 300 , 300 , mainWin)
Global quit:Int = False
ActivateGadget ta

SetGadgetFilter(ta, keyFilter)


While Not quit
	WaitEvent()
	
	Select EventID()	
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			quit = True

	End Select
Wend
End


Function keyFilter:Int(event:TEvent, context:Object)
	Select Event.ID
		Case EVENT_KEYCHAR
			If event.data < 48 Or  event.data > 57 Then Return False
	End Select
	
	Return True
End Function


*EDIT*
oops, textfield, not textarea. The principal is the same though.

So thats what the filter is for...

Thanks Pert. :)