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>inkey()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 INKEY()
 Extract a character from the keyboard buffer or a mouse event
------------------------------------------------------------------------------
 Syntax

     INKEY([<nSeconds>] [,<nEventMask>]) --> nInkeyCode

 Arguments

     <nSeconds> specifies the number of seconds INKEY() waits for a
     keypress or mouse event.  You can specify the value in increments as
     small as one-tenth of a second.  Specifying zero halts the program until
     a key is pressed or an unmasked event occurs.  If <nSeconds> is omitted,
     INKEY() does not wait for a keypress or mouse event.

     <nEventMask> specifies which events should be returned.  If
     <nEventMask> is omitted, the value represented by the
     SET EVENTMASK command will be used.  If there is no
     SET EVENTMASK command issued, the default value that will be used is 128
     (keyboard events only).

     This parameter can be any combination of the following values.  The
     constant values listed below are defined in Inkey.ch.

     Inkey Constants
     ------------------------------------------------------------------------
     Constant       Value     Descripiton
     ------------------------------------------------------------------------
     INKEY_MOVE     1         Mouse Events
     INKEY_LDOWN    2         Mouse Left Click Down
     INKEY_LUP      4         Mouse Left Click Up
     INKEY_RDOWN    8         Mouse Right Click Down
     INKEY_RUP      16        Mouse Right Click Up
     INKEY_KEYBOARD 128       Keyboard Events
     INKEY_ALL      159       All Mouse and Keyboard Events
     ------------------------------------------------------------------------

 Returns

     INKEY() 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, INKEY() returns 0.  INKEY() returns
     values for all ASCII characters, function, Alt+Function, Ctrl+Function,
     Alt+Letter, and Ctrl+Letter key combinations.

 Description

     INKEY() is a keyboard function that extracts the next key pending in the
     keyboard buffer or the next mouse event and returns a value representing
     the appropriate event.  The value is also saved internally and can be
     accessed using LASTKEY().  If the <nSeconds> argument is specified and
     there are no pending keys in the buffer, program execution pauses until
     a key appears in the keyboard buffer, or an appropriate mouse event
     occurs, or <nSeconds> has elapsed.  The time INKEY() waits is based on
     the operating system clock and is not related to the microprocessor
     speed.  If <nSeconds> is zero, program execution pauses until a key is
     pressed or an unmasked mouse event occurs.  Note that INKEY() is not a
     wait state and, therefore, SET KEYs are not active.

     INKEY() is similar to the NEXTKEY() function.  Unlike INKEY(), however,
     NEXTKEY() reads, but does not extract the key or mouse event.  This is
     useful when you need to test for a key or mouse event without processing
     it.

     INKEY() is the basic primitive of the CA-Clipper system for fetching
     keys and mouse events.  It is used for polling the keyboard, polling the
     mouse, or pausing program execution.  As an example, you can use INKEY()
     to terminate commands with a record scope such as LIST, LABEL FORM, and
     REPORT FORM by including it in a WHILE condition.

 Examples

     .  The following example will inform INKEY() to terminate if the
        left mouse button has been clicked or the right mouse button has been
        clicked.  If no events of this type occur within 10 seconds, INKEY()
        will terminate.

        ? INKEY( 10 , INKEY_LDOWN + INKEY_RDOWN )


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