
-----------------------------------
Alpha
Sun Feb 09, 2003 10:12 am

Key Press
-----------------------------------
Hi.

Say in a program after the initial run, you need to ask the user to either press R to rerun, enter to continue. How would you go about doing so?

-----------------------------------
Dan
Sun Feb 09, 2003 10:23 am


-----------------------------------
try somting like this:


var key: string(1)

put "hit  r to  returen, hit c to contwen"

loop
getch(key)

if key = "r" then
put "now going back to progame"
%code here
end if

if key  = "c"  then
put "contiuowing"
%code  here
end if
end loop


sory for  the bad spelling :(

-----------------------------------
Alpha
Sun Feb 09, 2003 8:01 pm


-----------------------------------
How about say if I wanted the user to press the Enter key in order for the program to continue. I can't seem to find anything that would allow key recognition.

-----------------------------------
Tony
Mon Feb 10, 2003 3:56 pm


-----------------------------------
you can use this program to determined ASCII value of any key pressed


var c:string(1)
getch(c)
put ord(c)


or just simply use


loop
if hasch then
getch(c)
exit
end if
end loop

continue program here...


hasch returns true if any key is waiting to be read from the buffer
