home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / WIN_CE / PC / coolcalczip.exe / advanced.htp next >
Encoding:
Text File  |  1997-09-24  |  15.6 KB  |  309 lines

  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
  2. <html>
  3.  
  4. <head>
  5. <meta http-equiv="refer" content="file:coolcalc.htc">
  6.  
  7.  
  8.  
  9. <title>Advanced Customization</title>
  10. </head>
  11.  
  12. <body bgcolor="#FFFFFF">
  13.  
  14. <h2>Advanced Customization </h2>
  15.  
  16. <p>Many of you won't need or want to get this deep into CoolCalc,
  17. but if you're really into creating your own custom formula
  18. screens or custom calculators, this section is for you.</p>
  19.  
  20. <p>This section answers the following questions:</p>
  21.  
  22. <dl>
  23.     <dt>What's the easiest way to create a formula screen?<br>
  24.         What are variables, and how do they work?<br>
  25.         Example: Creating a conversion screen<br>
  26.         Example: Creating a calculation screen<br>
  27.         </dt>
  28. </dl>
  29.  
  30. <h3>What's the easiest way to create a formula screen?</h3>
  31.  
  32. <blockquote>
  33.     <p>Formula screens come in two different types: conversions,
  34.     and calculations. An example of a conversion is the metric
  35.     conversion screens, i.e. converting temperature from Celsius
  36.     to Fahrenheit. Calculations are like the Loans screen, where
  37.     you enter the term, interest rate, and monthly payment, and
  38.     the amount you can borrow is calculated for you.</p>
  39.     <p>There are two templates you can use to create your own
  40.     formula screens: <strong>conversion template.mac</strong>,
  41.     and <strong>formula template.mac</strong>. Choose the
  42.     template that best matches the type of calculation you wish
  43.     to produce.</p>
  44. </blockquote>
  45.  
  46. <h3>What are variables, and how do they work?</h3>
  47.  
  48. <blockquote>
  49.     <p>As with any formula, CoolCalc's formula screens require
  50.     you to use variables. If you look at some of the buttons in
  51.     the formula screen templates, you'll see two functions being
  52.     used: _ShowVariable, and _SetVariable. The parameter to these
  53.     functions is always the name of the variable (variable names
  54.     are case sensitive). _ShowVariable displays the value of a
  55.     particular variable (using the Format property of the
  56.     button). _SetVariable assigns the value of a variable to the
  57.     contents of the display. </p>
  58.     <p>The variable functions are useful when creating formula
  59.     screens because you can use them to store and retrieve values
  60.     while recording macros. For doing conversions, the
  61.     _SetVariable buttons will be replaced with a macro that sets
  62.     all variables on the screen. For calculations, the ? buttons
  63.     will be replaced with macros that set variables.</p>
  64. </blockquote>
  65.  
  66. <h3>Example: Creating a conversion screen</h3>
  67.  
  68. <blockquote>
  69.     <p>We'll show you the steps we took to create the metric
  70.     weight conversion utility that ships with CoolCalc. The
  71.     technique we use is to modify conversion template.mac to our
  72.     specific conversion. In this example, we'll first create a
  73.     macro that takes ounces, and converts that value to pounds,
  74.     grams, and kilograms. Next, for grams, we'll convert that
  75.     value to ounces, and run the ounces macro again to fill in
  76.     the rest of the values. We'll repeat this process for
  77.     kilograms and pounds.</p>
  78. </blockquote>
  79.  
  80. <ol>
  81.     <li>Select <strong>File</strong>, <strong>Open</strong> from
  82.         the top menu, and open <strong>"conversion
  83.         template.mac"</strong>. </li>
  84.     <li>Save the template as <strong>test.mac</strong>. To do
  85.         this, select <strong>File, Save As</strong> from the top
  86.         menu, and enter "test".</li>
  87.     <li>Decide which variables you will want. For this example,
  88.         we'll use grams (g), kilograms (kg), ounces (oz) and
  89.         pounds (lbs).</li>
  90.     <li>Select <strong>View, Program Mode</strong> from the top
  91.         menu.</li>
  92.     <li>Delete the extra fields you don't need. Eight fields are
  93.         shown, and we only need four of them, so delete the
  94.         buttons labeled a, e, d, h, and the display buttons next
  95.         to them as well. (To delete a button, <strong>tap on it
  96.         once</strong>, then select <strong>Edit, Delete Button</strong>
  97.         from the top menu.)</li>
  98.     <li>Change the title of the layout to "weight
  99.         conversion". To do this, select <strong>File,
  100.         Properties</strong> from the top menu, and enter
  101.         "weight conversions" in the title field. Press
  102.         OK when finished.</li>
  103.     <li>Change the appearance of the variable buttons. Hold down
  104.         the Alt key and tap the button labeled "b", and
  105.         set the Alt. Keycap field to "g". Press OK.
  106.         Change the buttons labeled "c" to
  107.         "kg", "f" to "oz" and
  108.         "g" to "lbs" in the same way.</li>
  109.     <li>Return to Run Mode. (Select <strong>View, Run Mode</strong>
  110.         from the top menu).</li>
  111.     <li>Now, we record the macro that takes a value for ounces,
  112.         and calculates the number of pounds, grams, and
  113.         kilograms. First, press 1 to start the macro with a
  114.         value. Next, select <strong>Macro, Record Macro</strong>
  115.         from the top menu. When asked for the name of the macro,
  116.         type "test-oz". </li>
  117.     <li>The macro gets recorded as follows: press oz, then the
  118.         division button, then 16, = and press lbs to set the
  119.         value for pounds. Tap the button to the right of oz to
  120.         return the ounces value to the display, press X 28.35 =,
  121.         then press the button labeled g to set grams. Press the
  122.         division key, then 1000, then = and press the button
  123.         labeled kg to set kilograms. </li>
  124.     <li>Select <strong>Macro, End Record Macro</strong> to end
  125.         the macro. When you are prompted "OK to assign next
  126.         button pressed to new macro?", answer Yes. Tap the
  127.         button labeled oz to assign the new macro to the oz
  128.         button. We've just completed a quarter of the process;
  129.         now, if you enter a number then press the oz button, you
  130.         will have converted ounces to pounds, grams and
  131.         kilograms. Note that the oz button will read test-oz. You
  132.         can change this by returning to Program Mode (select <strong>View,
  133.         Program Mode</strong> from the top menu), then hold down
  134.         the Alt key and tap on the test-oz button, and then enter
  135.         oz in the Alt. Keycap field. Be sure to return to Run
  136.         Mode (Select <strong>View, Run Mode</strong> from the top
  137.         menu).</li>
  138.     <li>Next, we can record a macro for pounds. Press 1 to start
  139.         the macro with a value, then select <strong>Macro, Record
  140.         Macro</strong>. When asked for the name of the macro,
  141.         enter "test-lbs". </li>
  142.     <li>Now we actually record the macro for pounds. This is
  143.         easy, we simply convert to ounces by multiplying by 16,
  144.         and then let the ounces macro test-oz do the rest. Enter
  145.         X, then 16, then =. Now, press the oz button.</li>
  146.     <li>End the macro for pounds: select <strong>Macro, End
  147.         Record Macro</strong> from the top menu. When you are
  148.         prompted "OK to assign next button pressed to new
  149.         macro?", answer <strong>Yes</strong>. Tap the button
  150.         labeled lbs to assign the new macro to the lbs button.
  151.         You should change the name of the button back to lbs like
  152.         we did earlier for the oz button.</li>
  153.     <li>Repeat the same steps for the g and kg buttons; for
  154.         grams, divide by 28.35 to set ounces, and run the oz
  155.         macro. For kilograms, you can just divide by 1000, and
  156.         run the g macro you just recorded.</li>
  157.     <li>Save your work. (From the top menu, select <strong>File,
  158.         Save</strong>).</li>
  159.     <li><strong>Advanced stuff: </strong>if you want to make a
  160.         custom help file for your new test layout screen, you
  161.         will need to make a HTML file called
  162.         "cc-test.htp", and place it in your \Windows
  163.         directory on your HPC. (All help files for Coolcalc
  164.         screens start with "cc-" and end with
  165.         ".htp". Creating HTML files can be done using
  166.         Microsoft Word or other commercially available software,
  167.         but the specifics are beyond the scope of this document.</li>
  168. </ol>
  169.  
  170. <blockquote>
  171.     <p><br>
  172.     That's it! You can use these same steps and tricks to create
  173.     conversion screens of your own. Remember the key concepts:
  174.     first, use the "conversion template.mac" layout as
  175.     a starter for all of your conversions, and second, once you
  176.     make your first macro, you can let it do most of the work
  177.     when you create the other macros. Also, it's a good idea to
  178.     keep a consistent naming scheme among your macros and
  179.     layouts. Note how we named the layout macro test, and the
  180.     calculation macros test-oz, test-lbs, etc. Following this
  181.     convention will make life a lot easier for you as you add to
  182.     your collection of custom conversion screens.</p>
  183. </blockquote>
  184.  
  185. <h3>Example: Creating a calculation screen</h3>
  186.  
  187. <blockquote>
  188.     <p>Calculation screens are a nice way to present what-if
  189.     scenarios in a pleasing way. For example, the loans screen
  190.     that comes with CoolCalc is a nice example of a calculation
  191.     screen. You enter values for the known variables, then press
  192.     the ? button next to the unknown value, and the result
  193.     appears. Creating calculation screens is a bit simpler than
  194.     creating conversion screens. Use the file <strong>formula
  195.     template.mac</strong> as a basis for your custom calculation
  196.     screens. Again, as we did with the conversion example, be
  197.     sure to use a consistent naming convention for your layouts
  198.     and macros, i.e. if the layout is named xyz, and xyz used
  199.     variables var1 and var2, name your macros that go with the
  200.     layout xyz-var1, xyz-var2 etc.</p>
  201.     <p>For our example, we'll do a simple margin calculation as
  202.     would be used in a retail setting. Our variables are margin,
  203.     price, and cost. The formulas we will use will be:</p>
  204.     <p>margin=((price - cost)/cost) x 100.</p>
  205.     <p>price = cost / (1 - (margin/100))</p>
  206.     <p>cost = price x (1 - (margin/100))</p>
  207.     <p><strong>Here's how to do it:</strong></p>
  208. </blockquote>
  209.  
  210. <ol>
  211.     <li>Open <strong>formula template.mac</strong>. (From the top
  212.         menu, select <strong>File, Open</strong>, and choose <strong>"formula
  213.         template.mac"</strong>).</li>
  214.     <li>Select Program Mode. (From the top menu, select <strong>View,
  215.         Program Mode</strong>).</li>
  216.     <li>Save the template as "margin.mac" (From the top
  217.         menu, select <strong>File, Save As</strong>, and type
  218.         "margin". Then, press Enter.</li>
  219.     <li>Change the title of the screen to "margin
  220.         calculations". (From the top menu, select <strong>File,
  221.         Properties</strong>, and enter "margin
  222.         calculations" in the title field. Press OK.)</li>
  223.     <li>Remove any excess variables. Since four variables are
  224.         showing, and we need only three, delete the button
  225.         labeled "d", and the two buttons next to it.
  226.         (Select the "d" button, then from the top menu,
  227.         select <strong>Edit, Delete Button</strong>. Press the
  228.         enter key when prompted "Press OK to delete this
  229.         button". Repeat for the two buttons next to the
  230.         "d" button.) </li>
  231.     <li>Change the a button to reflect the cost variable. (Hold
  232.         down the Alt key, and tap the button labeled
  233.         "a". Change the parameter from "a" to
  234.         "cost".)</li>
  235.     <li>Change the button to the right of the cost button to
  236.         display the cost variable. (Hold down the Alt key, and
  237.         tap the button to the right of the cost button. Change
  238.         the parameter from a to cost.)</li>
  239.     <li>Repeat the previous two steps to change the b button and
  240.         the button to it's right to price. Also, change the c
  241.         button and the button to it's right to margin.</li>
  242.     <li>Now, we can start to record macros. First, we need to
  243.         return to Run Mode. (From the top menu, select <strong>View,
  244.         Run Mode</strong>.)</li>
  245.     <li>Let's create the macro to calculate margins. First we
  246.         need to seed the cost and price variables. We'll set cost
  247.         to 80, and price to 100, and this should give us a margin
  248.         of 20%. Press the 80 buttons, and then the button labeled
  249.         cost. Press 100, and then the price button.</li>
  250.     <li>Now we'll program the formula margin=((price -
  251.         cost)/cost) x 100, and assign it to the ? button to the
  252.         right of the margin button. Start the macro by selecting <strong>Macro,
  253.         Record Macro</strong> from the top menu. Enter the name
  254.         of the macro as margin-margin.</li>
  255.     <li>Do the formula. Press the button to the right of the
  256.         price button, then -, then the button to the right of the
  257.         cost button, then the division button, then the button to
  258.         the right of the price button, then the X button, then
  259.         100. If you see 20.00 in the display, press the margin
  260.         button.</li>
  261.     <li>End the macro and assign it to a key: from the top menu,
  262.         select <strong>Macro, End Record Macro</strong>. Answer
  263.         Yes when asked "Want to assign next button pressed
  264.         to new macro?". Tap the button labeled ? to the
  265.         right of the margin button.</li>
  266.     <li>Repeat this process for the buttons labeled ? to the
  267.         right of the cost and price buttons, but use the formulas
  268.         for cost and price. Make sure to call the macros
  269.         margin-cost and margin-price respectively. (Hint: if you
  270.         don't have the necessary buttons on screen to do the
  271.         formula, try the Edit, Execute Function menu selection.
  272.         In this example, you may need to use the Change Sign
  273.         function or the Left Parenthesis function. You can also
  274.         assign these functions to one of the empty buttons while
  275.         you are recording a macro as well by going in and out of
  276.         Program Mode.)</li>
  277.     <li>When you're finished with the macros, you'll want to
  278.         change the macro buttons back to their appearance of ? .
  279.         To do so, select <strong>View, Program Mode</strong> from
  280.         the menu, hold down Alt and tap the buttons, and set the
  281.         Alt. Keycap field to "?".</li>
  282.     <li>Save the layout! From the top menu, select <strong>File,
  283.         Save</strong>.</li>
  284.     <li>Return to Run Mode, and test your screen. (Select <strong>View,
  285.         Run Mode</strong> from the top menu).</li>
  286. </ol>
  287.  
  288. <blockquote>
  289.     <p><br>
  290.     That's it! You can enter 80 for cost, 100 for price, and you
  291.     should get 20 for the margin. Press the ? buttons next to
  292.     price and cost to test these calculations as well.</p>
  293.     <p><strong>More advanced stuff:</strong> you change the
  294.     format of your display fields to show a money display. From
  295.     Program Mode, edit the property of the buttons to the right
  296.     of the cost and price buttons and set the format to Money.
  297.     Return to Run Mode to see if you like how it looks.</p>
  298.     <p><strong>Really advanced stuff:</strong> you can also
  299.     change the number of digits (precision) of all values
  300.     displayed. For this screen, a single digit after the decimal
  301.     should suffice. From Run Mode, select Edit, Execute Function
  302.     from the top menu. Change the function to _Precision, and set
  303.     the parameter to the number of digits you wish to display (1
  304.     in this case). Press OK, and the margin value and display
  305.     will change to show one digit of precision. Make sure to save
  306.     the layout to keep the precision value.</p>
  307. </blockquote>
  308. </body>
  309. </html