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.3 . Guide To CA-Clipper - <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 an integer value from -39 to 386 for keyboard events
     and integer values from 1001 to 1007 for mouse events.  This value
     identifies either the key extracted from the keyboard buffer or the
     mouse event that last occurred.  If the keyboard buffer is empty, and no
     mouse events are taking place, LASTKEY() returns 0.  LASTKEY() returns
     values for all ASCII characters, function, Alt+Function, Alt+Letter, and
     Ctrl+Letter key combinations.

 Description

     LASTKEY() is a function that reports the INKEY() value of the last key
     fetched from the keyboard buffer by the INKEY() function, or the next
     mouse event, or a wait state such as ACCEPT, INPUT, READ, WAIT,
     ACHOICE(), DBEDIT(), or MEMOEDIT().  The time LASTKEY() waits is based
     on the operating system clock and is not related to the microprocessor
     speed.  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()

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