home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12827 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  1.8 KB

  1. Xref: sparky comp.lang.c:12827 comp.unix.questions:10417
  2. Path: sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!oxuniv!atmtjkv
  3. From: atmtjkv@vax.oxford.ac.uk
  4. Newsgroups: comp.lang.c,comp.unix.questions
  5. Subject: Re: cursor input on curses (new prob.)
  6. Message-ID: <1992Aug26.082112.8513@vax.oxford.ac.uk>
  7. Date: 26 Aug 92 07:21:12 GMT
  8. References: <1992Aug25.220112.1@hamp.hampshire.edu>
  9. Organization: Oxford University VAX 6620
  10. Lines: 28
  11.  
  12. In article <1992Aug25.220112.1@hamp.hampshire.edu>, jmolinari@hamp.hampshire.edu writes:
  13. >     A while ago I posted a question dealing with the curses library
  14. > package.  I asked how I could handle cursor input, e.g., "cursor-up, down,
  15. > etc."  Several people replied with variations of "use the keypad() function".
  16. > Problem is, keypad() doesn't seem to be implemented in our package of curses
  17. > (which is installed on a sun3 system).  It's not in the curses.h file, nor in
  18. > any of ther OTHER headers in our collection (I GREPped the directory, so I'm at
  19. > quite a loss.  If anybody can explain this and/or offer a solution, I will be
  20. > able to finish an ascii version of Minesweeper I'm working on for school.
  21. > Thank you!
  22. >             jmolinari@hamp.hampshire.edu
  23.  
  24. It's a tricky problem.  To be really portable and terminal
  25. independent, you have to parse the keystrokes and compare them
  26. with the values given in TERMCAP or its equivalent.  I haven't seen
  27. a version of curses that includes this, and most termcap files have
  28. *very* scanty information about key codes, particularly for function keys --
  29. they normally stop with up, down, left and right.  I have a routine to 
  30. do this parsing, and some fuller termcap entries, if you're interested.
  31. It reads the termcap file at run time, so it can cope with changes of
  32. terminal type.
  33.  
  34. -- 
  35. Tim Kingsmill-Vellacott
  36. Atmospheric, Oceanic and Planetary Physics
  37. University of Oxford, UK.
  38. tjkv@atm.ox.ac.uk  preferred
  39.