FT_SLEEP

FT_SLEEP
 Wait for a specified amount of time

 Syntax

      FT_SLEEP( <nSeconds>, [<nInitial>] ) -> nil

 Arguments

    <nSeconds> is the number of seconds to pause

    <nInitial> is an optional clock value (from a call to SECONDS())
               from which the <nSeconds> seconds are to elapse. Useful
               for setting a minimum time between the start of events
               which could take a variable amount of time due to the
               execution of intervening code.

 Returns

     NIL

 Description

     This routine will wait a specified period of time. It provides
     resolution based upon the execution of the SECONDS() function.
     It does not use an input state such as INKEY(). The specified time
     is the minimum time sleeping and will usually be slightly longer.

     The second optional argument allows one to begin timing an event
     prior to executing some operation. This is useful when, for example,
     you input a key or mouse click and wish to do something but still want
     to note if the user double entered (mouse or key) within a certain time
     which in turn may have meaning within your program's context.

     The routine correctly handles passing through midnight but will not
     work for more than 24 hours.

 Examples

     Example 1:
         FT_SLEEP(10.0)    && Sleep for 10.0 seconds
     Example 2:
         nTime=SECONDS()   && usually after some interupt from mouse or
                           && keyboard

         ... intervening code ...

         FT_SLEEP(0.5, nTime) && Sleep until the sytem clock is
                              && nTime+0.5 seconds.

 Source: SLEEP.PRG

 Author: Leo Letendre

 

FT_SINKEY

FT_SINKEY()
 Replacement for INKEY() that tests for SET KEY procedures

 Syntax

      FT_SINKEY( [ <nWaitTime> ] ) -> nKey

 Arguments

     <nWaitTime> is the number of seconds to wait.  If zero,
     FT_SINKEY() will wait indefinitely for a keypress.  If not
     passed, FT_SINKEY() does not wait for a keypress.  If NIL,
     it is treated the same as 0.

 Returns

     The INKEY() value of the key pressed.

 Description

     FT_SINKEY() is similar to the function provided by Nantucket in
     KEYBOARD.PRG, with one significant difference: you can pass NIL
     to INKEY(), which will be treated as a zero (i.e., wait indefinitely
     for keypress).  Therefore, it is necessary to differentiate between
     an explicit NIL and one that is a result of a formal parameter NOT
     being received.

     FT_SINKEY() differs from the standard INKEY() in that it will
     respond to any keys set with SET KEY TO or SetKey().

 Examples

     SetKey( K_F1, {|n,l,r| Help(n,l,r) } )
     nKey := FT_SINKEY(0)       // Help() will be called if F1 pressed

 Source: SINKEY.PRG

 Author: Greg Lief