Ah Allen
You got caught by a simple mistaken glance - the code says
INPUT, 1
Not
INPUT, -1
And so no sleep command is necessary as the machine will wait for the next
key input, and not simply loop forever! Of course, if the user decides to
leave a brick on his / her keyboard, one might run into this problem.
But you brought up an interesting point that I should have added to the
original post - the possibility of trapping escape characters...
A similar loop can be implemented that traps any key input, so that you
don't have to be limited to using a space to exit a prompt, but rather use,
for example, the ESC key. To do this one would use INPUT,-1. The problem
with this approach is handling the BACKSPACE key.
Eg
InputtedValue = ''
InpCol=1
LOOP
print @(InpCol,1):@(-4): ; * position the cursor so we
can handle backspace
INPUT Val,-1
BEGIN CASE
CASE Val=CHAR(27) ; EXIT ; * escape entered, get out of
loop
CASE Val=CHAR(09) ; * use TAB to go to next
prompt
CURRENT.PROMPT +=1
EXIT
CASE Val=CHAR(08) ; * BACKSPACE.KEY
InpCol -= 2 ; * cater for 1 added below
InputtedVal[len(InputtedVal),1]='' ; * remove last char (if any)
CASE 1; InputtedVal := Val
END CASE
InpCol += 1
REPEAT
What is great about this approach is the ability to use arrow keys, PgUp,
PgDn, Insert, End, etc. As with everything computing, the problem then is to
get everyone to have the same terminal emulation running.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Allen Egerton
Sent: 30 April 2008 11:32 AM
To: [email protected]
Subject: Re: [U2] Press any key to continue...
Dennis Bartlett wrote:
<snip>
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/