home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 7863 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  1.6 KB

  1. Xref: sparky comp.lang.pascal:7863 comp.sys.ibm.pc.programmer:739
  2. Newsgroups: comp.lang.pascal,comp.sys.ibm.pc.programmer
  3. Path: sparky!uunet!wupost!gumby!destroyer!Tygra.Michigan.COM!dave
  4. From: dave@tygra.Michigan.COM (David Conrad)
  5. Subject: Re: Cursor and F1-F12 keys under Turbo-Pascal
  6. Organization: CAT-TALK Conferencing System
  7. Date: Tue, 5 Jan 1993 10:57:55 GMT
  8. Message-ID: <1993Jan5.105756.12801dave@tygra.Michigan.COM>
  9. References: <1993Jan4.134821.325@sinus.stgt.sub.org>
  10. Lines: 35
  11.  
  12. In article <1993Jan4.134821.325@sinus.stgt.sub.org> stefan@sinus.stgt.sub.org (Stefan Bechtold) writes:
  13. >How can I use the cursor keys and the F1,F2...F12 keys under
  14. >Turbo-Pascal. Is there any solution (as it's not possible
  15. >through ASCII-chars) ?
  16.  
  17. I usually do something like the following:
  18.  
  19. var
  20.   ch, c : char;
  21.  
  22. begin
  23.   repeat
  24.     ch := readkey;
  25.     if ch = #0 then c := readkey;
  26.     case ch of
  27.       #13 : writeln ('You pressed enter.');
  28.       #0 : case c of
  29.              #72 : writeln ('You pressed the up arrow.');
  30.              #80 : writeln ('You pressed the down arrow.');
  31.              #59 : writeln ('You pressed F1.');
  32.            end;
  33.     end;
  34.   until ch = #27;
  35.   writeln ('You pressed escape.');
  36. end.
  37.  
  38. Note that readkey will not detect F11 and F12.  To find out how to do this,
  39. look at keyboard.pas in /pc/turbopas/drcpas10.zip at garbo.uwasa.fi.
  40.  
  41. David R. Conrad
  42. -- 
  43. =  CAT-TALK Conferencing Network, Computer Conferencing and File Archive      =
  44. -  1-313-882-2209, 300bps-14400bps, V.32/V.32bis/TurboPEP New users use 'new' - 
  45. =  as a login id.  AVAILABLE VIA PC-PURSUIT!!! (City code "MIDET")            =
  46.    E-MAIL Address: dave@Michigan.COM
  47.