Using Actions in Presentations

You might write an action to perform a transformation on a model that you could use while presenting your data. In that situation, you would like to be able to invoke the action as fluidly as possible during your presentation. With Quantrix, you can connect an action to a scripted button on a presentation canvas, so you can invoke the action by clicking the button. The steps below show you how to create a presentation canvas that uses the Parity Check action. Provided you have created a model with the parity check script in a previous step, you can use that model to walk through this step.

Start by creating a new presentation canvas and adding a table view to it for Matrix1, as follows:

1. Add a new presentation canvas to the model by clicking the Insert Presentation Canvas toolbar button.

2. Add a table view for Matrix1 by clicking the Insert Canvas Table View toolbar button, selecting Matrix1 from the resulting dialog, and clicking within the canvas.

3. You can add the scripted button from the Canvas toolbar, or from the Script Manager. The Canvas toolbar has an Add Scripted button icon:

If you click the Add Scripted button, you see the Parity Check script:

You can alternatively open the Script Manager and (assuming the Parity Check action is written) drag the Parity Check action onto the canvas. A button is automatically created with the label “Parity Check”. You may need to resize the button before the entire label will be visible.

4. Click the Layout button on the canvas toolbar to switch to Interact mode.

5. Test your new scripted button. Enter a value into the cell A1:B1 on the canvas and click the Parity Check button. The action is invoked and the result displays.

Note: It is possible to allow a user to execute a script that runs on a hidden view, by using a privileged method{} in the script. For example, if the user has no permission to open Matrix1, but the script needs to get values from Matrix1:

GroupOrItemSelection selection

   privileged

   {

      selection = |Matrix1::A1..A3|

   }

   selection.values

 

Non-modelers cannot edit scripts.

Assigning Hotkeys to Actions

If you use an action often enough, you may want to assign a hotkey to it so that you can invoke it using a keyboard shortcut. Quantrix allows you to assign the numbers 0 through 9 as hotkeys for up to ten actions in a model. To run an action using its hotkey, hold the Ctrl key on Windows or the Command key on Mac OS X and then press the appropriate number key. You can assign a hotkey to an action using the hotkey button in the action editor. The button displays the shortcut for the currently assigned hotkey or the text “None” if no hotkey is assigned. An action can be assigned a hotkey only if it is showing in the scripting menu (that is, if its Scripting Menu checkbox is enabled in the action editor).

Below is the Hotkey assignment that displays when you click the Hotkey button:

See Also

Writing Function Sets