Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>lastkey()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 LASTKEY()
 Return the INKEY() value of the last key extracted from the keyboard buffer
------------------------------------------------------------------------------
 Syntax

     LASTKEY() --> nInkeyCode

 Returns

     LASTKEY() returns a number between -39 and 386, identifying the INKEY()
     value of the last key extracted from the keyboard buffer.

 Description

     LASTKEY() is a keyboard function that reports the INKEY() value of the
     last key fetched from the keyboard buffer by the INKEY() function, or a
     wait state such as ACCEPT, INPUT, READ, WAIT, ACHOICE(), DBEDIT(), or
     MEMOEDIT().  LASTKEY() retains its current value until another key is
     fetched from the keyboard buffer.

     LASTKEY() has a number of uses which include:

     .  Determining the key that terminates a READ

     .  Determining the key that exits the current Get object within a
        user-defined function, invoked by a VALID clause

     .  Identifying an exception key in the user function of
        ACHOICE(), DBEDIT(), or MEMOEDIT()

     LASTKEY() is also used with UPDATED() to determine if any Get object's
     buffer was changed during a READ.

     LASTKEY() is related to NEXTKEY() and READKEY().  NEXTKEY() reads the
     current key pending in the keyboard buffer without removing it.  Use
     NEXTKEY() instead of INKEY() when polling for a key.

     For a complete list of INKEY() codes and Inkey.ch constants for each
     key, refer to the Error Messages and Appendices guide.

 Examples

     .  This example illustrates a typical application of LASTKEY() to
        test the key that exits a READ.  If the user exits with any key other
        than Esc and a GET was changed, the specified database file is
        updated:

        #include "Inkey.ch"
        //
        USE Customer NEW
        MEMVAR->balance = Customer->Balance
        @ 10, 10 SAY "Current Balance" GET MEMVAR->balance
        READ
        //
        IF (LASTKEY() != K_ESC) .AND. UPDATED()
           REPLACE Customer->Balance WITH MEMVAR->balance
        ENDIF

 Files:  Library is CLIPPER.LIB, header file is Inkey.ch.

See Also: CHR() INKEY() KEYBOARD NEXTKEY() Inkey codes

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