Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
runaway cursor
#1
I could use some help with the following:

I have a block cursor on the screen, just above a horizontal line with numbers from 0-10. The user moves the cursor with the arrow keys, and presses enter to indicate a rating for a specific question.

Then another question comes up, and the the process repeats.

But I can't figure out how to stop the cursor from running off the right side of the screen and wrapping around to the next line. This usually doesn't happen, but if the user gets carried away (or is just playing around!) then it starts erasing everything on the next line -- plus it makes me look like the amateur I am....

Any suggestions on how to keep track of the cursor and stop its errant travels would be appreciated.

Thanks
Reply
#2
Basically you need to limit the input length. This will require writing your own INPUT system, rather than using the built-in command. There are loads of other threads on this topic, but the basic outline is like this:

Code:
MyString$ = ""
DO
  DO
    ThisKey$ = INKEY$
  LOOP UNTIL ThisKey$ <> ""  
  IF LEN(MyString$) < 15 THEN MyString$ = MyString$ + ThisKey$
LOOP UNTIL ThisKey$ = CHR(13)

You will need to add your own code to display a cursor (if you want it) and support the backspace key or whatever...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)