Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Input box with set variable
#1
I need to setup an input box that limits the user to x amount of numbers. My current input text box specifically asks for 3 numbers, problem is users can type as may as they want at this point. Any way to limit the amount?
#2
Macro
Code:
Copy      Help
int i
inp- i "" "" "" 0 "" inp_Limit3Digits
out i

Function inp_Limit3Digits
Code:
Copy      Help
;/
function# str&s

s.replacerx("\D") ;;remove nondigits
s.fix(3 2) ;;limit to 3 characters
#3
I tried both suggestions, didn't quite the way I was looking for. Following is the line asking for the input.

if(!inp(IP "please type the 3 numbers provided by the WVLC tech staff" "IP address" "")) ret

Like I mentioned, right now this opens a text box, and they can type in all the numbers they want. If I can linit it to "3", that would be awesome. 8)
#4
It is 1 suggestion. The macro shows an input box. The function runs when the user types a character in the input box. It does not allow to type more than 3 digits.
#5
I tried the Macro,
int i
inp- i "" "" "" 0 "" inp_Limit3Digits
out i

one problem is that it doesn't know what "inp_Limit3Digits" is, then I am not sure where to place it. I have already set a STR called IP. The 3 numbers I want them to type will complete the IP address as seen below ie: 10.99.IP.2. If you get a chance, can you show me where to add your Macro?

str IP
10
if(!inp(IP "please type the 3 numbers provided by the WVLC tech staff" "IP address" "")) ret
OnScreenDisplay _s.format("Starting network connection:[]IP: 10.99.%s.222 []Mask: 255.255.255.0 []GW: 10.99.%s.1[]" IP IP)15 600 600 "Arial" 14 0x00000f
#6
Macro
Code:
Copy      Help
str IP
;g1
if(!inp(IP "please type the 3 numbers provided by the WVLC tech staff" "IP address" "")) ret
if(findrx(IP "^\d\d\d$")<0) goto g1
#7
That did it :o Thanks for your time
#8
Hey, I Put this together, Thought it looked a bit better.
Big Grin

str IP
;g1
if(!inp(IP "please type the 3 numbers provided by the WVLC tech staff" "IP address" "")) ret
if(findrx(IP "^\d\d\d$")<0) goto g2
else goto b
;g2
if(!inp(IP "You typed in more than 3numbers please try again [] Thanks WVLC tech staff" "IP address" "")) ret
if(findrx(IP "^\d\d\d$")<0) goto g2
else goto b
;b


Forum Jump:


Users browsing this thread: 1 Guest(s)