Adding Shortcut Commands to Shapes

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.

Figure 25-9. This door allows users to reverse its left/right and in/out openings and set display options from its shortcut menu. (An ampersand in the name defines the command’s keyboard shortcut.)


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.


Adding a Predefined Action

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.

Figure 25-10. Just as you can define a double-click behavior for a shape, you can add a shortcut command for a shape in the Action dialog box.


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.

Adding a Smart Tag to Your Shape

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:

1.
Select the shape and choose Window, Show ShapeSheet.

2.
Select the ShapeSheet and select Insert, Section. Select the Smart Tags check box and click OK. A Smart Tag section and one Smart Tag row appear in the ShapeSheet window.

3.
Choose a display mode in the DisplayMode cell of the Smart Tags section for the Smart Tags row that you are working on, then press Enter. These are the modes: 0 indicates that the tag appears when the cursor is passed over the shape; 1 indicates that the tag appears when the shape is selected; and 2 indicates that the tag always remains on screen. Note that in modes one and two you cannot see/use the tag unless the shape is selected.

4.
Type a name in the TagName cell and press Enter. This name will link your Smart Tag to an action in the Action section of the ShapeSheet. Choose something simple like Tag1.

5.
Display the Actions section for a shape, as described in the previous procedure.

6.
In the Menu box, type the name of the command as you want it to appear on the Smart Tag drop-down menu.

Note

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. Click the blank Menu or Action cell, and then choose Edit, Action.

Because adding an entry in the TagName cell (in Step 8) will prevent the action from being displayed on the context menu when you right-click the shape, you should add a new row for your Smart Tag action even if the action you want to add is already present in the Actions section.

7.
Under Action, choose the action you want the command to take, and then click OK.

8.
In the TagName cell, type the name in the Smart Tag’s TagName cell and press Enter. For example, if you entered Tag1 in the Smart Tag’s TagName cell, you would enter Tag1 here.

9.
Close the ShapeSheet window.

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.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset