doh doh and err doh!! i made a slight mistake in the snippet i sent so here it is all fixed and working properly!! my bad... lol
sync on
mainloop:
text$=""
clear entry buffer
intext$=""
while intext$=""
cls
center text 320,50,"Enter your string"
` this will show the current input text before ya press enter
center text 320,100,text$
gosub CheckInput
`this will end loop if return was pressed after input was done
if sendmsg=1
intext$=text$
endif
sync
endwhile
cls
print "restarting loop"
sync
wait 1000
goto mainloop
` this is the subroutine you will call from another loop
CheckInput:
`this var holds the max length of the string to be entered
MaxLengthOfText=20
sendmsg=0
`read the current keyboard entry buffer, add to text$ var, clear the buffer
`get whatever has been typed from the windows entry buffer since this was last called
text$=text$+entry$()
`dont forget to clear it!!
clear entry buffer
`check for backspace
IF asc(right$(text$,1))=8
`and if backspace was pressed remove the backspace char and the previous char
IF LEN(text$)>0 THEN text$=LEFT$(text$,LEN(text$)-2)
endif
`check for enter key
if asc(right$(text$,1))=13
`drop the return char from the string so an empty string cant get passed
text$=LEFT$(text$,LEN(text$)-1)
`if text$ var is not empty let calling routine know text$ var is ready for use
if text$<>"" then sendmsg=1
endif
`this line limits the length of the string
if len(text$)>MaxLengthOfText then text$=left$(text$,MaxLengthOfText)
clear entry buffer
return
optic blast! megablast! have a blast!!