Come on guys.

This is getting sort of silly.
Why on earth would anybody want to replace the Return key with the space bar?
OK if you wanted to allow ESC, but still...
That single character input problem exists since Hector was a pup.
Been there, done that as a junior programmer.
And what do you do, if you have typed a wrong character and want to go back?
Backspace won't work any more.  - Doh!
The way we tackled it on Pick was to use GET in a loop.
There is an equivalent command in UniBasic too, I just can't remember what it is. It gets a single character at the time, and waits - INPUT ans,1 does that BTW too, so you don't need a SLEEP or RQM as Dennis suggests. AFAIK you can even set a wait time, so if nothing happens, you can display a message or log the user off.
Of course you then have to decide what you want to do.
So if you put a backspace in, you have to remove the previous character from the string. The beauty of it is, that you can use Escape-sequences (i.e. arrow keys) and even make programs respond to mouse clicks, if your emulator is capable of recognising them.

As always, use the right tool for the job - in this case not INPUT.




Allen Egerton wrote:
Dennis Bartlett wrote:
<snip>
One way to beat this, and still allow you to use a single space as an exit character, would be to create a loop that inputs a single character, then
tests if that character is a space. If so, exit the loop, if not, append
that character to the end of a string, eg

InputtedValue = ''
Loop
   Input Val,1:
   if Val=' ' then exit
   InputtedValue := Val
Repeat
<snip>

This is correct, as is the rest of Dennis' post; but I'll add one caveat. When I've written this sort of loop, it's often been necessary to add a sleep or delay in the loop. Otherwise when this process is executing the computer can use the user's entire timeslice looping, 'cause there's always something for the computer to do. Which will tend to bog the machine down for the other users, (much as a very intensive SELECT will do).

Obviously this can also be dependent upon userload, hardware, operating system and Pick/U2 variant - some combinations work better than others.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to