home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / pascal / 6417 < prev    next >
Encoding:
Text File  |  1992-11-09  |  2.2 KB  |  55 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!rz.uni-hildesheim.de!mleb0097
  3. From: mleb0097@rz.uni-hildesheim.de (Mark Lebius)
  4. Subject: Re: inputting non-character keys
  5. Message-ID: <1992Nov9.121307.9694@rz.uni-hildesheim.de>
  6. Sender: news@rz.uni-hildesheim.de
  7. Reply-To: mleb0097@rz.uni-hildesheim.de
  8. Organization: Universitaet Hildesheim, RZ
  9. References: <92309.190434JLHHC@CUNYVM.BITNET>
  10. Distribution: world
  11. Date: Mon, 9 Nov 1992 12:13:07 GMT
  12. Lines: 41
  13.  
  14. In article 190434JLHHC@CUNYVM.BITNET, Jack Hammond <JLHHC@CUNYVM.BITNET> () writes:
  15. >How does Turbo Pascal (I have 5.0) read such non-character keys as the
  16. >function keys, insert, home, pgup etc., and alt-keys?
  17.  
  18. Hello Jack!
  19. Use the function ReadKey (I'm not sure if it is available in TP 5.0; if
  20. not: e-mail me).
  21. If you have pressed a function key this will first return character #0.
  22. If you call ReadKey again, it will return a character as normal. Here
  23. is a little program (I don't tested it, but it should work).
  24. It's written for TP6.0. If you have problems ... see above:
  25.  
  26. PROGRAM TestKey;
  27. VAR a : CHAR;
  28. BEGIN
  29.   REPEAT
  30.     a:=Readkey;          (*Get charakter from keyboard.*)
  31.     WriteLn(Ord(a));     (*Write the ordinal number of the char.*)
  32.   UNTIL FALSE;
  33. END.
  34.  
  35. You stop this program by pressing simultaniously Ctrl+Break.
  36. It returns the values of the pressed keys. The function-keys
  37. return 2 values: 0 and x, a value depending on the function-
  38. key.
  39. Hope this helps.
  40.  
  41. Bye,
  42. Mark
  43.  
  44. -------------------------------------------------------------------------------
  45. |Mark Lebius                   |        University of Hildesheim              |
  46. |Mergenthalerweg 25            |        E-Mail: mleb0097@rz.uni-hildesheim.de |
  47. |W-3000 Hannover 81            |                mleb1097@rz.uni-hildesheim.de |
  48. |Tel. ++ 49 (5 11) 8 43 68 20  |                                              |
  49. |Germany                       |                                              |
  50. -------------------------------------------------------------------------------
  51. "Geh nicht immer auf dem vorgezeichneten Weg, der nur dahin fuehrt, wo andere
  52.  bereits gegangen sind"
  53.                            A. G. Bell (1847-1922)
  54.  
  55.