CT_KEYSEC

 KEYSEC()
 Triggers a key trap after a time delay
------------------------------------------------------------------------------
 Syntax

     KEYSEC([<nKeyValue>,<nTime>, [<nCounter>],
        [<lMode>]]) --> lActivated

 Arguments

     <nKeyValue>  Designates the key code to place in the keyboard
     buffer.

     <nTime>  Designates the time, in seconds, after which the character
     is placed in the buffer.  Negative values correspond to multiples of
     1/18.2 seconds.

     <nCounter>  Designates the number of times the function occurs
     before it uninstalls itself.  A value of -1 indicates that KEYSEC() will
     continue until it is specifically uninstalled.  The default value is
     "Uninstall after the first call" (1).

     <lMode>  Designates whether the internal time counter restarts at
     the beginning (.T.) or not (.F.), after you press a desired key.  The
     default value is "No new start with key stroke" (.F.).

     ()  When called without parameters, the function is completely
     uninstalled.

 Returns

     KEYSEC() returns a value of .T. when installed correctly, so that the
     desired character will be placed in the keyboard buffer after the
     specified time.

 Description

     This function is useful in DEMO programs.  If used in conjunction with
     KEYSEND(), you can simulate any keyboard input with time delays.

     Use KEYSEC() in conjunction with Clipper's SET KEY..TO, for key traps
     (just like KEYTIME()).  For example, this makes it possible to
     automatically write data still in the DOS buffer, to the hard drive at
     specific intervals during a GET..READ.

     As soon as the character is placed in the keyboard buffer <nCounter>
     times, KEYSEC() uninstalls itself.

     If the <lMode> parameter is specified as .T., the elapsed time counter
     is reset when you press any key.

     If you want to specifically uninstall the function from the program,
     call it without parameters.

 Notes

     Warning!  Always uninstall the function before you leave the program
     or use the CTUS.LIB Extended Drivers found in Clipper Tools.  The
     function changes interrupt vectors, and if the previous status is not
     restored before you exit the program, the system will eventually crash.

     .  Only one time delay can be active.  A new KEYSEC() deactivates
        the previous one.

     .  You can use any symbols defined in the Clipper file
        INKEY.CH.  You can set any other keys described in the Clipper
        Tools header file CTSCAN.CH.

 Examples

     .  Place CHR(7) in the keyboard buffer three times, every 5
        seconds:

        ? KEYSEC(7, 5, 3)             // (.T.)

     .  Place CHR(255) in the keyboard buffer every 60 seconds until
        an uninstall occurs:

        ? KEYSEC(255, 60, -1)         // (.T.)

     .  As soon as a key is pressed, the internal counter restarts
        from the beginning:

        ? KEYSEC(13, 60, -1, .T.)     // (.T.)

See Also: KEYTIME() LASTKLINE() LASTKFUNC() LASTKPROC()

 

Introduction Miscellaneous Functions

 

Introduction

     Functions that do not belong in any other module are assembled in this
     group under the Miscellaneous heading.  However, this does not imply
     they are less useful.  For example, use KEYTIME() or KEYSEC() to
     activate a Clipper procedure at a specific time, after a delay of
     seconds, implement file saves, or control demo programs.

     This module enables you to determine complements, determine data types,
     and query keyboard scan codes.

 Passing Parameters by Reference

     Finally, this chapter discusses functions that permit you to pass
     parameters by reference.  To find more information on this subject, see
     Chapter 4, String Manipulations.

Tools – Miscellaneous Functions

Introduction Miscellaneous Functions
ALLOFREE()*  Determines the maximum memory size allocation
BLANK()      Creates a blank value for each data type
COMPLEMENT() Forms the complement value of a data type
DATATYPE()*  Determines the data type of a variable or UDF
GETTIC()     Determines the number of timer ticks
KBDDISABLE() Locks/unlocks the keyboard
KBDEMULATE() Inserts characters into BIOS keyboard buffer to emulate input
KBDSPEED()   Sets keyboard auto repeat speed
KBDSTAT()    Tests for key shift state status, such as Ctrl and Shift
KBDTYPE()    Determines the type of keyboard in use
KEYSEC()     Triggers a key trap after a time delay
KEYTIME()    Triggers a key trap at a specific clock time
MILLISEC()   Time delay in milliseconds
NUL()        Converts the value returned by a function into a null string
SCANKEY()    Queries scan code of keyboard input
SETTIC()     Increases number of time ticks
SHOWKEY()    Continuously displays the INSERT and LOCK status
SOUND()      Creates tones (melodies) by designating frequency and duration
SPEED()      A comparison value used to determine the processor speed
STACKFREE()  Determines the remaining stack space
TOOLVER()    Queries the version number of the Clipper Tools in use
XTOC()       Converts an expression of any data type into a string