A customer recently asked how to read some input from the user in XJEase. The next major release of XJTAG (probably numbered 2.4) will contain a new XJEase function INPUTBOX that makes doing this much simpler. In the meantime, I thought I might outline some code that accomplishes the same thing in the current version.
The core of the code is a loop that simply calls the WAITKEY function to read a character of input at a time, until a carriage return is read. As each character is read it is appended to a string that will be returned and also printed to the screen.
This works reasonably well until the user makes a mistake and wants to backspace. Handling backspace requires us to print the backspace character and remove the last character from the string that we’re building. We can also check the current length of the input string and not allow the user to backspace beyond its start.