Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No INPUT?
#2
Input isn't directly supported, no. It's one of a very short list of Sinclair Basic commands that is externalized. The problem is that the Sinclair Basic input command is a very complex beast - it includes most of the functionality of PRINT for example - and it also stops the computer dead while it's waiting for input. Further, ZX Basic treats the whole screen as one with 24 lines, not a lower area and an upper area.

Boriel decided not to include it directly because there are other ways of getting user data, such as inkey.

However there is a library function that implements the heart of it - #include <input.bas> at the start of the program to add that functionality in.

You can then use variable$ = input(MaxLength) to get an input cursor the user can type at and delete mistakes. It returns a string, and it allows up to MaxLength characters. It will put an input cursor at the most recently used print position; so use PRINT AT just beforehand to position it. You can certainly do print at 23,0 to put it where you'd be used to having it - though it may misbehave if the user is allowed to type more than a whole line.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)