CALC 1 Key Editor
The Key Editor is similar adding a number in the Contacts app that comes with your iPhone. You need a label and script instead of a name and phone number.
You can also use the Key Editor to view the key script of a key to better understand it. It is a good source of documentation.
The key editor screen contains the following fields:
- Label: This is the key label that you see on the key. It needs to be short enough to fit on the key.
- Hint: The hint is the text that is displayed when the user used the "long press" gesture on the key.
- Insert:
- Enter text to be inserted into a formula when in algebraic (ALG) calculation mode. The script will not be executed if there is text in the insert field when in ALG mode. This includes operator, (+,
-,
×, ÷, ^, %, (, ))
- In CHN mode the script will be evaluated unless the insert field is an operator, (+,
-,
×, ÷, ^, %, (, )).
- Leave blank to execute the scripts in any calculation mode.
- Enter "=" to evaluate the pending ALG or CHAIN mode expression (pressing the = key for you) and then execute the script.
- Undo: This controls the undo support for this key.
- History: This controls the automatic history support for this key. UN-check if the script will provide a custom history item.
- Key Type: There are many key types. This document covers the "script" type that is used for customization.
- Calc Modes: These properties control the calculation modes that the key will appear. Usually you will leave all checked. This is used for keys like the parenthesis and "K" keys so they will not be displayed in RPN calculation mode.
- Key Preview: This is used to indicate that this is part of Calculate-STO-RCL set of keys.
- Style Group: The style group of the Styles. This will determine the key image for the key.
- Stack Post Op: This has 4 choices to manage the stack after the script is run.
- None. The script will manage the stack.
- Last X. The last x value will be set to the rgx pre-script value. This is typically used for unary functions like √, ln,...
- Lift: Lift the stack. rgt=rgz, rgz=rgy, rgy=rgx(pre-script value). Typically used for keys script that RCL a value or calculate a value that did not use the rgx value directly. Any RCL key or the TVM top row keys like N, I/YR, PV,.. are examples.
- Drop: Drops the Stack. rgy=rgz, rgz=rgt. Typically used when the script uses rgy and rgx to calculate a singe value and return it to rgx. The +, -,
×,
÷ in RPN calculation mode will are examples.
Explanation of how the "Insert" field is used for different calculation modes.
For the √ key shown in the screen shot at the top of this page:
In RPN calculation mode, the "Insert" field is ignored and the script is evaluated as follows:
- The script is evaluated and the result (last statement) is assigned to the rgx value.
- The StackPost Op will be run.
In ALG calculation mode, the "√(" text is inserted into the current formula and the script is ignored.
In CHN calculation mode, the script is evaluated as in RPN calculation mode.
Script
Tap the Script button to view, edit and test the JavaScript in the Script Editor.
The Toolbar Buttons
- Save: Tap this button to save changes made to the key. This will only be enabled if the calculator is a custom calculator.
- Cancel: Tap this to exit without saving any changes.
- Copy: Tap this to copy the key to the clipboard.
- Paste: Tap this key to paste a key that has been copied to the clipboard. If this action replaces an existing key the information for that key will be saved to History.
- Trash: Tap this to delete the key. Then the parent calculator's key for this position and shift state will be seen on the calculator. information for the key will be saved to History.
More Examples
CALC 1 has hundreds of keys that you can look at for examples.