home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / database / pk4pak.zip / POPCALC.DOC < prev    next >
Text File  |  1992-08-25  |  8KB  |  172 lines

  1. CALCULATOR
  2.  
  3. A basic Calculator. By Henrik Bechmann of Elect Software International Inc., Toronto
  4.  
  5. =============================================================================
  6.                            CALCULATOR DESCRIPTION
  7. =============================================================================
  8.  
  9. This is a basic calculator.
  10.  
  11. The user can operate the calculator like any other. To select the value resulting from the calculations, the user hits either the [OK] button on the calculator, or presses [F2]-Do_It!.
  12.  
  13. If the user selects a value from the calculator, then the Calculator.Dialog() returns true, otherwise it returns false. If Calculator.Dialog() returns true, then the selected value can be picked up from the property Calculator.Value.
  14.  
  15. =============================================================================
  16.                            CALCULATOR USAGE
  17. =============================================================================
  18.  
  19. The simplest way to use the Calculator is to 
  20.  
  21.         Play "PopCalc"
  22.  
  23. The default bahavior will place a selected value in a numeric or dollar field or in a memo if the workspace is in "Edit" or "CoEdit" mode.
  24.  
  25. Alternatively, you can load procedures from the Popcalc.sc script at the beginning of your application like this:
  26.  
  27.         Librarian.HasControl = True
  28.         Play "Popcalc"
  29.         Release Vars Librarian.HasControl
  30.  
  31. You can then call Calculator.Constructor() , Calculator.Dialog(), and Calculator.Constructor() according to the documentation below. Or you can just call Calculator.Show() to get the default behavior described in the first option.
  32.  
  33. As a third alternative, you can write all the procedures in Calculator.sc to a library, and handle them accordingly.
  34.  
  35. =============================================================================
  36.                          CALCULATOR OPERATIONS
  37. =============================================================================
  38.  
  39. The ESI-PD40B calculator is a basic business calculator that supports the
  40. following operations:
  41.                            ------------ Available from -------------
  42.  Operation     Type        Keyboard       PushButton  OpMenu
  43.  ---------     ----------  -----------------------------------------
  44.  Add           Postfix     [+]            "+"         {Add}
  45.  Subtract      Postfix     [-]            "-"         {Subtract}
  46.  Multiply      Infix       [*]            "*"         {Multiply}
  47.  Divide        Infix       [/]            "/"         {Divide}
  48.  Exponent      Infix       [^]                        {Exponent}
  49.  Percent       Function    [%]                        {Percent}
  50.  Factorial     Function    [!]                        {Factorial}
  51.  Reverse sign  Function    [Alt-R]        "Rev"       {Reverse sign}
  52.  Square root   Function    [Alt-Q]                    {Square root}
  53.  Round,2       Function    [Alt-N]                    {Round,2}
  54.  SaveMem       Function    [>]                        {SaveMem}
  55.  GetMem        Function    [<]                        {GetMem}
  56.  Subtotal      Postfix     [Alt-S]        "Sub"       {Subtotal}
  57.  Total         Terminator  [=] or [Enter] "="         {Total}
  58.  Clear         Terminator  [Alt-L]        "Clr"       {Clear}
  59.  
  60. In addition it has a numeric keypad that contains the numerals 0 - 9 and the
  61. decimal point.
  62.  
  63. Postfix operations operate on a number or numbers that have preceded the operator. 
  64.  
  65. Infix operations apply to the numbers immediately preceding and following the operator. Infix operations are nested, ie. they are resolved before their postfix cousins are resolved.
  66.  
  67. Functions apply only to the number currently in the input cell.
  68.  
  69. As a simple example, to add 3 - 6 = -3, enter 3 + 6 - [Enter].
  70.  
  71. For a more complex example, to calculate a bill with tax for five items: 1 coke at $1.00, three burgers at $2.00 each, and one out of a case of three apple crisps, when the case is worth $6.00, with tax altogether of 7%: enter the following keystrokes:
  72.  
  73.       1 + 2 * 3 + 6 / 3 [Alt-S] * 7 % [Enter]
  74.  
  75. When [Enter], [=], or [Alt-S] are entered without a preceding + or - operator, the + operator is assumed.
  76.  
  77. So, the above keystroke sequence is equivalent to:
  78.  
  79.   (1 + (2 * 3 = 6) + (6 / 3 = 2) = 9 + (9.00 * (7/100 = .07) = .63) = 9.63
  80.  
  81. The Paper tape would show:
  82.  
  83.       1.00 +
  84.       2.00 *
  85.       3.00 =
  86.       6.00 +
  87.       6.00 /
  88.       3.00 =
  89.       2.00 +
  90.       9.00 Subtotal
  91.       9.00 *
  92.       7.00 % =
  93.        .07 :
  94.        .07 =
  95.        .63 +
  96.       9.63 Total
  97.  
  98. The calculator will use the previously calculated figure of the input cell if an operator is hit without entering a new number in the input cell. The input cell shows the running total of the calculation. This running total is automatically replaced by a number that you input in the input cell.
  99.  
  100. Thus 3 + + + [Enter] will give 9.00, while showing 3,6,9 after each plus, and 9 after the [Enter].
  101.  
  102. The paper tape is available for viewing and editing from the Menu, and this help text is available for viewing from the Menu.
  103.  
  104. =============================================================================
  105.                            CALCULATOR INTERFACE
  106. =============================================================================
  107. Methods:
  108. --------
  109.  
  110. Calculator.Constructor()
  111.  
  112. Syntax: Calculator.Constructor()
  113.  
  114. Returns: Nothing.
  115.  
  116. Description: Creates the Calculator in memory.
  117.  
  118. Usage: Issue Calculator.Constructor() at the beginning of the session with Calculator, or at the beginning of your application. If Calculator.Constructor() is called once at the beginning of your application, then each time the user views the Calculator, he or she will see the value that was selected the last time the Calculator was used.
  119.  
  120. ------
  121. Calculator.Destructor()
  122.  
  123. Syntax: Calculator.Destructor()
  124.  
  125. Returns: Nothing.
  126.  
  127. Description: Destroys Calculator in memory.
  128.  
  129. Usage: Call Calculator.Destructor() at the end of the Calculator session if Calculator.Constructor() was called at the beginning of the Calculator session, or call Calculator.Destructor() at the end of your application if Calculator.Constuctor() was called at the beginning of your application.
  130.  
  131. ------
  132. Calculator.Dialog()
  133.  
  134. Syntax: Calculator.Dialog()
  135.  
  136. Returns: True if the user selected a value, otherwise returns false. If it returns true, then as a side effect Calculator.Value is set to the value the user selected.
  137.  
  138. Description: Displays the Calculator and waits for user input.
  139.  
  140. Usage: Issue Calculator.Dialog() when you want to display the Calculator to the user, after issuing Calculator.Constructor() and before issuing Calculator.Destructor().
  141.  
  142. Example:
  143.         Calculator.Constructor()    ; create the Calculator
  144.         If Calculator.Dialog() Then ; user has selected a value
  145.            [] = Calculator.Value     ; place value in numeric field
  146.         Endif
  147.         Calculator.Destructor()     ; destroy the Calculator
  148.  
  149.  
  150. Properties:
  151. -----------
  152.  
  153. Calculator.Value
  154.  
  155. Data type: Numeric
  156.  
  157. Description: The value in the input cell at the time of exit from the Calculator.
  158.  
  159. ------
  160. Calculator.ExplainFile
  161.  
  162. Data type: Alpha, default "Popcalc.hlp"
  163.  
  164. Description: If you run Calculator from a directory other than the directory containing the help file (Popcalc.hlp) then change Calculator.ExplainFile to "<path>\\popcalc.hlp" right after issuing Calculator.Construcor().
  165.  
  166. ------
  167. Calculator.IsActive
  168.  
  169. Data type: Logical
  170.  
  171. Description: (readonly) indicates if Calculator.Constructor() has been run. Use IsAssigned(Calculator.IsActive) to test existence of the Calculator.
  172.