home *** CD-ROM | disk | FTP | other *** search
- TEXT
- *******************************************************************************
- *
- * DEMONSTRATION DRIVER FOR: This demo displays some of this header on
- * the screen because the save and replace
- * of the screen area really impresses the guy
- * who wrote this driver.
- *
- * FUNCTION CALCUL8 - Pop up calculators for Clipper applications
- * CALC_B () has tape/no tape option
- * CALC_N () has no tape
- * CALC_T () has a tape
- *
- *
- * USE:
- * result = calc_b (<expN1>, <expN2>, [<expL>], [@array1>])
- * result = calc_n (<expN1>, <expN2>, [@array1>])
- * result = calc_b (<expN1>, <expN2>, [@array1>])
- *
- * RETURNS:
- * accumulated result of calculations (up to 99,999,999.9999
- * and down to -9,999,999.999
- *
- ENDTEXT
- * FOUR PARAMETERS:
- * <expN1>, <expN2> - top and left position of the
- * calculator display - REQUIRED
- * <@array1> - Four element array of colors (e.g. W/N)
- * for calculator colors (defaults are
- * listed below in parentheses COLOR:B/W):
- * array[1] - (W+/BG:W+/n ) = Calculator body
- * array[2] - (N/BG :N/w ) = Text color
- * array[3] - (N/W :N/W ) = Tape/accumulator
- * array[4] - (W+*/W:W+*/W) = Error message
- * <expL> - Indicator of whether to display
- * the calculator tape (optional). If
- * not supplied, default is .F. (no tape).
- * Note that this parameter is passed only
- * to CALC_B().
- *
- * COMMENTS:
- * CALCUL8 saves and restores the existing color scheme and
- * the screen area it uses.
- *
- * CALCUL8 identifies all its variables as PRIVATE, so it
- * should not clobber any of your application's variables.
- *
- * CALCUL8 uses two embedded functions: rithmetik and check_tape
- *
- * LIMITATIONS:
- * The top left of CALCUL8 must be within 0,0 through 13,44
- * if the tape is displayed, and within 0,0 through 14,59 if
- * the tape is not displayed.
- *
- *
- *******************************************************************************
-
- DECLARE calc_color[4]
- calc_color[1] = 'W+/BG'
- calc_color[2] = 'N/BG'
- calc_color[3] = 'N/W'
- calc_color[4] = 'W+*/W'
-
- SET DECIMALS TO 4
-
- * This demo puts the calculator in several places on the screen
- * in the default colors. It alternates between CALC_N, CALC_T, and CALC_B.
- * CALC_B alternates between using the tape and not. The result is
- * displayed at the top right.
- *
- * Use Alt-C to exit
-
- use_tape = .T.
-
- SETCOLOR('N/W')
-
-
- DO WHILE .T.
- @ 24, 0 clear to 24,79
- @ 24,28 say "The 'no tape' version"
- top = 10
- left = 44
- calc_result= calc_n(top,left) && Calculator wo/tape
- @ 0,65 SAY calc_result PICTURE '99,999,999.9999'
-
- @ 24,27 say "The 'with tape' version"
- top = 2
- left = 2
- calc_result= calc_t(top,left,@calc_color) && calculator w/tape
- @ 0,65 SAY calc_result PICTURE '99,999,999.9999'
-
- IF use_tape
- @ 24,22 SAY "The switchable version with tape ON"
- ELSE
- @ 24,22 SAY "The switchable version with tape OFF"
- ENDIF
- top = 10
- left = 22
- calc_result= calc_b(top,left,use_tape,@calc_color) && calculator w/select
- @ 0,65 SAY calc_result PICTURE '99,999,999.9999'
-
- use_tape = .NOT. use_tape && Toggle for CALC_B
- ENDDO
-