maxspaces% = 40
showcursor% = 7 ' Use 7 to show the cursor or zero to hide it. A value of 30 makes it a small square.
CALL getinput
(word$
, maxspaces%
, limitinput$
, showcursor%
, autoenter%
)
LOCATE 12, 5:
PRINT "The input is now in the variable word$ as: " LOCATE 14, 41 - LEN(word$
) / 2 ' Centers the print in the next line.
' Now here is another way to use the sub and keep the clock running.
PRINT "Try again? Y/N ";
' Remember to always use a ";" after the print statement to keep your input on the same line. limitinput$ = "YyNn"
autoenter% = 1 ' Automatically enter response after one key is pressed.
maxspaces% = 10
showcursor% = 0 ' Hide the cursor for yes/no responses.
CALL getinput
(word$
, maxspaces%
, limitinput$
, showcursor%
, autoenter%
)
limitinput$ = "" ' Always erase variable for other uses.
autoenter% = 0 ' Always erase variable for other uses.
SUB getinput
(word$
, maxspaces%
, limitinput$
, showcursor%
, autoenter%
) ' Input Statement with clock.
endpos% = startpos% + maxspaces%
word$ = "" ' Erases last entry to begin next entry.
IF TIME2
< 48 THEN TIME2
= TIME2
+ 10: TIME1
= TIME1
- 1
' KEY INPUT GOES HERE....................................................
' Used for a non-enter response, like answering yes or no.
' Exits the input sub back to your main program.
' Quit and removes program winsow.
BEEP ' Input error, retry.
action:
word$
= MID$(word$
, 1, POS(0) - startpos%
) + key$
+ MID$(word$
, POS(0) - startpos%
+ 1) word$
= MID$(word$
, 1, POS(0) - startpos%
) + key$
+ MID$(word$
, POS(0) - startpos%
+ 2)
wash:
delete:
word$
= MID$(word$
, 1, POS(0) - startpos%
) + MID$(word$
, POS(0) - startpos%
+ 2)