Numerical TextField
BlitzMax Forums/MaxGUI Module/Numerical TextField
| ||
Is there a way to make a TextField gadget only accept numbers. I'd also like to be able to align the text/numbers to the right of the TextField too. If this is not currently possible I'd like to make a feature request for a TEXTFIELD_NUMERICAL style flag or a NumberField gadget. Any help would be appreciated. Thanks. |
| ||
I asked this question before some time ago. The results from my thread are below. It works flawlessly. It requires a little bit of work to intergrate it in to your code but the technique is sound. http://www.blitzbasic.com/Community/posts.php?topic=55626#619096 :) |
| ||
Thanks Amon it's a start.Function CreateNumberField:TGadget( x:Int, y:Int, w:Int, h:Int, group:TGadget) Local g:TGadget=CreateTextField(x,y,w,h,group) SetGadgetFilter g,NumFilter Return g End Function Function NumberFieldNumber:Float( numberfield:TGadget ) Return Float(TextFieldText(numberfield)) End Function Function NumFilter:Int(event:TEvent, context:Object) If Event.ID=EVENT_KEYCHAR If (event.data > 47 And event.data < 58) Or event.data = 8 Or event.data = 46 Then Return True Else Return False EndIf Return True End FunctionJust need to get the text to align to the right now and I'll be sorted. |
| ||
Hello, I also need to align the text to the right. But i didn't find anyway to make it. thanks. |