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>nextkey()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 NEXTKEY()
 Read the pending key in the keyboard buffer
------------------------------------------------------------------------------
 Syntax

     NEXTKEY() --> nInkeyCode

 Returns

     NEXTKEY() returns an integer numeric value ranging from -39 to 386.  If
     the keyboard buffer is empty, NEXTKEY() returns zero.  If SET TYPEAHEAD
     is zero, NEXTKEY() always returns zero.

 Description

     NEXTKEY() is a keyboard function that reads the keystroke pending in the
     keyboard buffer without removing it.  The value returned is the INKEY()
     code of the key pressed--the same value as returned by INKEY() and
     LASTKEY().  NEXTKEY() returns values for all ASCII characters as well as
     function, Alt-function, Ctrl-function, Alt-letter, and Ctrl-letter key
     combinations.

     NEXTKEY() is like the INKEY() function, but differs in one fundamental
     respect.  INKEY() removes the pending key from the keyboard buffer and
     updates LASTKEY() with the value of the key.  NEXTKEY(), by contrast,
     reads, but does not remove the key from the keyboard buffer and does not
     update LASTKEY().

     Since NEXTKEY() does not remove the key from the keyboard buffer, it can
     be used to poll the keyboard then pass control to a routine that uses a
     wait state or INKEY() to actually fetch the key from the buffer.

     For a complete list of INKEY() codes and Inkey.ch constants, refer to
     the CA-Clipper Inkey Codes Appendix in the Error Messages and Appendices
     guide.

 Examples

     .  This example places an Esc key in the keyboard buffer then
        shows the differences between INKEY(), LASTKEY(), and NEXTKEY():

        #include "Inkey.ch"
        //
        CLEAR TYPEAHEAD
        KEYBOARD CHR(K_ESC)
        //
        ? NEXTKEY(), LASTKEY()            // Result: 27 0
        ? INKEY(), LASTKEY()              // Result: 27 27
        ? NEXTKEY()                       // Result: 0

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

See Also: INKEY() KEYBOARD LASTKEY() SET TYPEAHEAD Inkey codes

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