Limiting numbers in editbox window
Posted: Wed Jun 04, 2008 18:29
I had been searching the forums for this topic and saw that some people had similar questions, but I didn't find a whole lot about how to implement it.
My problem was when creating an editbox window, I wanted to limit the characters being entered and specifically I wanted only numeric values in the range of 0-359. Here's how I was able to do it after reading up on regular expression syntax.
First it has been explained that you can limit what kind of input is acceptable in the editbox via the setValidationString function. The string this takes in is based on regular expression or regex. You can do a google search on regex and see all the nifty things that can be done with it.
Now here is how I solved my specific problem, only numbers 0 - 359.
"(3[0-5][0-9]|[0-2]?[0-9]?[0-9]?)"
Pass that into setValidationString() and you'll get the proper results.
I hope this helps someone save some time. I'm sure that you can do the research on your own and figure it out, but that's what I've come up with. Now all I need to know is why the number pad doesn't seem to inject input. Anyone know a solution for that?
My problem was when creating an editbox window, I wanted to limit the characters being entered and specifically I wanted only numeric values in the range of 0-359. Here's how I was able to do it after reading up on regular expression syntax.
First it has been explained that you can limit what kind of input is acceptable in the editbox via the setValidationString function. The string this takes in is based on regular expression or regex. You can do a google search on regex and see all the nifty things that can be done with it.
Now here is how I solved my specific problem, only numbers 0 - 359.
"(3[0-5][0-9]|[0-2]?[0-9]?[0-9]?)"
Pass that into setValidationString() and you'll get the proper results.
I hope this helps someone save some time. I'm sure that you can do the research on your own and figure it out, but that's what I've come up with. Now all I need to know is why the number pad doesn't seem to inject input. Anyone know a solution for that?