If you like to put Visio 2007 commands at your fingertips, you can define commands that appear when you right-click a shape. All Visio 2007 shapes’ shortcut menus include a number of commands for formatting and editing, and if you know how to program in the ShapeSheet, you can write your own command to do anything you want. However, with a minimum of ShapeSheet knowledge, you can add a shortcut command to do any of the actions provided by the Double-Click tab in the Behavior dialog box. In addition, this section shows you how to program a ShapeSheet function for putting any Visio 2007 command on a shape’s shortcut menu.
When you want to add a command to a shape’s shortcut menu, you must display the Actions section of the ShapeSheet window. For some shapes, this section already appears in the ShapeSheet window. For other shapes, you have to add it. The Actions section includes cells that define the names of commands as they appear on a shape’s shortcut menu (the Menu cell) and the action to take when the command is selected (the Action cell), as Figure 25-9 shows.
Follow these steps to display the Actions section:
1. | Select a shape, and then choose Window, Show ShapeSheet. |
2. | Scroll down in the ShapeSheet window until you see the Actions section. If you don’t see it, choose Insert, Section. Select the Actions check box, and then click OK. |
A newly inserted Actions section doesn’t do anything as is. To create a command, you have to type a label enclosed in quotation marks in the Menu cell, and then define the action to take in a formula in the Action cell. However, you can let Visio 2007 write the formula to execute any of the actions provided by the Double-Click tab in the Behavior dialog box, as the following section explains.
Note
You can add additional rows in the Actions section by right-clicking a cell and selecting Insert Row.
You can use the Action command, which is available only in the ShapeSheet window, to add a right-click action to a shape. (The shape must be selected when you right-click it to see the new command.) The Action dialog box provides the same options as the Double-Click tab of the Behavior dialog box, as Figure 25-10 shows. The difference is that Visio 2007 creates a command on the shortcut menu instead of defining a double-click action.
Follow these steps to add a predefined action:
1. | Display the Actions section for a shape, as described earlier in “Adding Shortcut Commands to Shapes.” |
2. | If the shape already includes actions, you must insert a new row as follows: Click in the last Menu or Action cell to select it. Then right-click the cell and choose Insert Row (if there is currently only one row in the section) or Insert Row After (if there is more than one row).
|
3. | Click the blank Menu or Action cell, and then choose Edit, Action. |
4. | In the Menu box, type the name of the command as you want it to appear on the shortcut menu. |
5. | Under Action, choose the action you want the command to take, and then click OK. |
6. | To test the new command, click the Close button in the ShapeSheet window to return to the drawing page. First select the shape, then right-click it, and choose the new command. |
Visio 2007 allows users not only to add Smart Tags to their shapes, but also to enable the tags to trigger the functions normally associated with shortcut menus. Smart Tags normally appear when the mouse is passed over the shape, but they can be set either to appear when the shape is selected or to remain permanently visible. To add a Smart Tag to a shape, follow these steps:
Now, when you click on the shape’s Smart Tag, a menu appears that displays the name just chosen in the Menu cell. Clicking the name executes the action.
Note
One action can apply to numerous tags. For example, you can link the Show ShapeSheet action to the Sheet TagName. Each action in the Action section with the Sheet TagName will appear in the Smart Tag menu.