C5_NEXTKEY

 NEXTKEY()
 Read the pending key in the keyboard buffer
------------------------------------------------------------------------------
 Syntax

     NEXTKEY() --> nInkeyCode

 Returns

     NEXTKEY() returns an integer numeric value ranging 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, NEXTKEY() returns zero.  If SET
     TYPEAHEAD is zero, NEXTKEY() always returns zero.

 Description

     NEXTKEY() is a function that reads the keystroke pending in the keyboard
     buffer or the next mouse event 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.  by contrast NEXTKEY()
     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, and 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 "Clipper Inkey Codes Appendix" in the Error Messages and
     Appendices Guide.

 Examples

     .  This example places an Esc key in the keyboard buffer, and
        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: KEYBOARD SET TYPEAHEAD

 

Advertisements

2 responses to “C5_NEXTKEY

  1. Pingback: C5 UI General | Viva Clipper !

  2. Pingback: C5_SET TYPEAHEAD | 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.