[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
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 CA-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 CA-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 CA-Clipper file
INKEY.CH. You can set any other keys described in the CA-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()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson