Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>readkey() similar to dbase iii plus readkey() examplep.prg</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ReadKey()      Similar to dBASE III PLUS READKEY()     Examplep.prg


Syntax:        ReadKey()

Returns:       An integer numeric value.

               ReadKey() returns a code representing the key pressed to
               exit a READ mode.  The following keys are supported:

                Table: ReadKey() return codes
               ------------------------------------
                 Exit Key              Return Code
               ------------------------------------
                 PgUp                   6
                 PgDn                   7
                 Esc                   12
                 Ctrl-End, Ctrl-W      14
                 Type past end         15
                 Return                15
               ------------------------------------

Notes:         . If UPDATED() is true (.T.), ReadKey() returns the code
                 plus 256.

               . If READEXIT() returns true (.T.) and an Uparrow or
                 Dnarrow terminates a READ, ReadKey() returns zero.  To
                 change this to reflect dBASE III PLUS behavior, add the
                 following lines to the CASE structure in the source
                 code of ReadKey():

                  CASE LASTKEY() = 5             && Uparrow
                     RETURN  4 + IF(UPDATED(), 256, 0)
                  CASE LASTKEY() = 2             && Dnarrow
                     RETURN  5 + IF(UPDATED(), 256, 0)


Library:       EXTEND.LIB


--------------------------------- Source Code ------------------------------

   FUNCTION ReadKey
   *
   DO CASE
   CASE LASTKEY() = 18                           && PgUp
      RETURN  6 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() =  3                           && PgDn
      RETURN  7 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() = 27                           && Esc
      RETURN 12 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() = 23                           && Ctrl-W
      RETURN 14 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() = 13                           && Enter
      RETURN 15 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() = 31                           && Ctrl-PgUp
      RETURN 34 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() = 30                           && Ctrl-PgDn
      RETURN 35 + IF(UPDATED(), 256, 0)
   CASE LASTKEY() >= 32                          && type past end
      RETURN 15 + IF(UPDATED(), 256, 0)
   ENDCASE


See Also: LASTKEY() NEXTKEY() UPDATED() Keyboard codes

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson