home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database / CLIPR503.W96 / READKEY.PR_ / READKEY.PR
Text File  |  1995-06-20  |  2KB  |  86 lines

  1. /***
  2. *
  3. *  Readkey.prg
  4. *
  5. *  Summer '87 READKEY() Compatibility Routine
  6. *
  7. *  Copyright (c) 1993, Computer Associates International Inc.
  8. *  All rights reserved.
  9. *
  10. */
  11.  
  12. #include "Inkey.ch"
  13.  
  14.  
  15. /***
  16. *
  17. *    READKEY()
  18. *
  19. *    Return a number representing the key pressed to exit from full-screen mode
  20. *
  21. *    Note: Differences between dBASE's READKEY() and Clipper's LASTKEY():
  22. *
  23. *         Exit Key:      dBASE:      Clipper:
  24. *         ---------      ------      --------
  25. *         Backspace         0        no exit
  26. *         ^D, ^L            1        no exit
  27. *         Lt arrow          2        no exit
  28. *         Rt arrow          3        no exit
  29. *         Up arrow          4        no exit
  30. *         Dn arrow          5        no exit
  31. *         PgUp              6          18
  32. *         PgDn              7           3
  33. *         Esc, ^Q          12          27 (Esc only)
  34. *         ^End, ^W         14          23 (^W only)
  35. *         type past end    15        ascii of last char typed
  36. *         Enter            15          13
  37. *         ^Home            33        no exit
  38. *         ^PgUp            34        no exit
  39. *         ^PgDn            35        no exit
  40. *         F1               36        no exit
  41. *
  42. *         dBASE III adds 256 to the exit code if the user changed anything.
  43. *         Clipper uses its UPDATED() function to determine if anything
  44. *         has changed.
  45. */
  46. FUNCTION READKEY()
  47.  
  48.     DO CASE
  49.    CASE LASTKEY() == K_UP
  50.       RETURN  ( 4 + IF( UPDATED(), 256, 0 ))
  51.  
  52.    CASE LASTKEY() == K_DOWN
  53.       RETURN  ( 5 + IF( UPDATED(), 256, 0 ))
  54.  
  55.    CASE LASTKEY() == K_PGUP
  56.       RETURN  ( 6 + IF( UPDATED(), 256, 0 ))
  57.  
  58.    CASE LASTKEY() == K_PGDN
  59.       RETURN  ( 7 + IF( UPDATED(), 256, 0 ))
  60.  
  61.    CASE LASTKEY() == K_ESC
  62.       RETURN ( 12 + IF( UPDATED(), 256, 0 ))
  63.  
  64.    CASE LASTKEY() == K_CTRL_W
  65.       RETURN ( 14 + IF( UPDATED(), 256, 0 ))
  66.  
  67.    CASE LASTKEY() == K_ENTER
  68.       RETURN ( 15 + IF( UPDATED(), 256, 0 ))
  69.  
  70.    CASE LASTKEY() == K_CTRL_PGUP
  71.       RETURN ( 34 + IF( UPDATED(), 256, 0 ))
  72.  
  73.    CASE LASTKEY() == K_CTRL_PGDN
  74.       RETURN ( 35 + IF( UPDATED(), 256, 0 ))
  75.  
  76.    CASE LASTKEY() >= K_SPACE                    // Type past end
  77.       RETURN ( 15 + IF( UPDATED(), 256, 0 ))
  78.  
  79.    OTHERWISE
  80.       RETURN ( 0 )
  81.  
  82.     ENDCASE
  83.  
  84.    RETURN ( 0 )      // This never executes...
  85.  
  86.