Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Grumpfish Library 3.2 - <b>popstop()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
POPSTOP()

    This comes in quite handy for professionals who bill on an hourly
    basis.  For example, an attorney could pop up the stopwatch in the
    middle of a Clipper application to time a phone call with a client.  He
    could then go about his business while the stopwatch ticked merrily
    away in the background.

    Background Operation

    To make use of background stopwatch operation, you must declare a
    public variable named START_TIME in your program prior to the point
    where the stopwatch would be invoked.

    Press Alt-B to activate the stopwatch in the background.  The
    previous screen will be restored immediately, but the stopwatch will
    be ticking away behind the scenes.  When you pop it up again to
    check the elapsed time, the message "(*** background ***)" will
    appear to remind you that it is already running.  You may press any
    key to stop the clock.  If you want to return to your program
    without stopping the stopwatch, press Esc.

    Foreground Operation

    To run the stopwatch normally, just press any key to start and stop
    it.  Press Esc when you want to exit the stopwatch.

    User-Defined Color/Position

    The color and screen position of the stopwatch window may be
    changed "on-the-fly".  The following keys may be used;

    UpArrow - move stopwatch up one row
    DnArrow - move stopwatch down one row
    LtArrow - move stopwatch left one column
    RtArrow - move stopwatch right one column
    Ctrl-LtArrow - move stopwatch to far left
    Ctrl-RtArrow - move stopwatch to far right
    Home - move stopwatch to top left corner
    End - move stopwatch to bottom right corner
    PgUp - move stopwatch to top row
    PgDn - move stopwatch to bottom row
    Alt-F10 - change color of stopwatch window

    Pressing Alt-F10 will display the interactive color palette. You may
    change the color by using the arrow keys to navigate through the
    palette.  Press Enter to select the desired color.  If you press
    Esc, the color will be unchanged. (Please refer to the discussion on
    COLORPAL() elsewhere in this manual for further specifics).

    If you change either the screen position or the color, upon exit you
    will be asked if you wish to save the new settings.  If so, the
    following three PUBLIC variables will be created:

    GFSTOPLEFT    Stores leftmost column for stopwatch window
    GFSTOPTOP     Stores top row for stopwatch window
    GFSTOPCOL     Stores color to use for stopwatch window

    POPSTOP() checks for the presence of these variables upon entry, and
    if they are detected, it will use their values in place of the
    defaults, which are 4, 26, and white on blue, respectively.
    If you wish to save these settings in a more permanent fashion,
    you could easily modify the source code to write these variables
    to a .mem file, then restore them at the top of your
    program.

    Using the Stopwatch in your programs

    To make use of the background stopwatch operation, you must declare
    a public variable named START_TIME in your program prior to the
    point where the stopwatch would be invoked.

    As with the other applications, there are two ways to utilize the
    stopwatch.  The first (and best) is to use SET KEY to establish a
    hot-key so that the user can pop up the stopwatch anywhere within
    the program.  The following lines added at the top of your program
    configure the F5 key to serve as the hot key for the stopwatch and
    enable background operation:

    *** Summer '87 syntax                           
    EXTERNAL popstop     && make symbol for linker  
    PUBLIC start_time    && for background operation
    stopkey = -4         && hot key: F5             
    SET KEY stopkey TO popstop                      

    *** Clipper 5.0 syntax 
    #include "inkey.ch"    
    SET KEY K_F5 TO popstop

    If you want to use a different hot key for the stopwatch, please
    refer to your Clipper manual for a list of INKEY() values.

    The second method is to call the stopwatch directly.  See the
    Calculator section above for a sample menu.  Once again, I strongly
    recommend using SET KEY, especially if you are planning to use this
    in the background.

    Clipper 5.0 Notes

    - All PUBLIC variables have been eliminated.
    - Changes to position and/or color are handled with STATIC variables.
    - You may now use background operation without having to declare
      START_TIME as PUBLIC in the calling routine.
    - It is no longer necessary to declare the variable STOPKEY when
      assigning a hot key.
    - It is no longer necessary to declare POPSTOP as EXTERNAL, because
      SET KEY will automatically establish a symbol for the function.

See Also: POPCALC() COLORPAL() GINKEY()

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