C5_LASTKEY

 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()

 

Advertisements

3 responses to “C5_LASTKEY

  1. Pingback: C5 UI General | Viva Clipper !

  2. Pingback: C5_SET KEY | Viva Clipper !

  3. Pingback: C5_READ | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.