Setting up double-click insertion for calc methods
You can set up your templates (or other files that support use of calc method libraries) so that end users in plan files can insert calc methods by double-clicking on a row, instead of needing to use the Add Row(s) menu item. To do this, you use the GetCalcMethod function in the row where you want user to insert calc methods.
GetCalcMethod is a simple function that takes a single parameter:
GetCalcMethod("DisplayText")
The DisplayText is the text to display in the cell, such as "Double-click to add a new account". By default, the text displays as normal text in the cell. If you want the text to look like a clickable hyperlink, you must manually format the cell text (for example, blue and underlined).
Example use of GetCalcMethod
NOTES:
- The placement of the function in the sheet depends on whether you are using the optional parameter of the InsertCM tag to control the insertion location. By default, calc methods are inserted above the current row. However, you can configure the InsertCM tag to specify that calc methods are inserted below the current row if desired.
- Make sure that the column which contains the GetCalcMethod function is wide enough to contain all of the display text. If the display text is wider than the column and spills into adjacent columns, then the user may end up double-clicking in the wrong place. For example, if you place the function in column F, and then make column F very small so that most of the text displays in column G, users may end up clicking on column G and nothing will happen.
GetCalcMethod Requirements
When a cell containing the GetCalcMethod function is double-clicked, a calc method will be inserted at the current location, if the following conditions are met:
- The user has the appropriate file group permissions to insert calc methods.
- The row is enabled for calc method insertion (via standard calc method controls), or calc method controls are not being used in the sheet.
If either of the above conditions are not met, then an appropriate error message is displayed to the user.
NOTE: If dynamic calc method controls are used in the sheet (DynamicCMColumn), then GetCalcMethod cannot be used to insert calc methods. The function will behave as if no rows are enabled for insertion. However, if the sheet uses both dynamic controls and standard controls, then the function will work as expected with enabled rows in the InsertCMColumn.
GetCalcMethod Behavior
If no calc method controls are used in the sheet, then double-clicking GetCalcMethod behaves in the same way as using File Options > Add Row(s) > Insert Calc Method(s). The user selects from any calc method in the library, and that calc method is inserted.
If calc method controls are used in the sheet, then the presence or absence of an InsertCM tag on the row controls the behavior when GetCalcMethod is double-clicked:
- If the row does not have an InsertCM tag, or if an InsertCM tag is present but it does not allow insertion, then no calc method insertion is performed. An appropriate error message is displayed to the user.
- If the row has an InsertCM tag that allows insertion, the settings in the tag control the insertion. Settings such as allowed calc methods, insert location, and prompting for insert count are all honored. The behavior is the same as if the user had selected this row as a custom insertion point. If only one calc method is allowed, it is automatically inserted (including the optional prompt for inserting multiple items, if applicable). If multiple calc methods are allowed, the user selects one of the calc methods.