How to display custom properties as text in Visio

Summary

This article explains how to display text that is derived from a shape's custom properties in Microsoft Visio. In this article, the "process" shape from the Basic flowchart stencil is used for illustration purposes. If you use an alternate shape, make sure the shape has custom properties, and that you have entered values into the custom properties.

This article assumes that you have used the ShapeSheet before and are familiar with adding sections and typing formulas.

More Information

A simple example

Drag the "process" shape to the drawing page. Right-click the shape to enter values into the three custom properties (cost, duration, and resources). Each property accepts only a numeric value.

  1. While the shape is still selected, click Field on the Insert menu.
  2. On the Category menu, click Custom Formula.
  3. Once chosen, the Custom Formula bar becomes active. Place the mouse pointer in the field and type Prop.Cost.
  4. Click OK. The shape's text now displays the value of the Prop.Cost row in the Custom Properties section of the ShapeSheet.

Determining the valid row names

For a shape that already has custom properties, it is necessary to determine how to properly reference the custom property rows.

  1. While the shape is selected, click Show ShapeSheet on the Window menu.
  2. Scroll to find the Custom Properties section of the ShapeSheet. If it is not visible, click Sections on the View menu. Check custom properties.
  3. The Custom Properties section will have named rows. The "process" shape has 3: Prop.Cost, Prop.Duration, and Prop.Resources. The "Prop" in the name is added automatically by Visio.

A complex example

The simple example works satisfactorily to display one custom property. The following example explains how to add additional text and custom properties to the display. Again, using the "process" shape with values added into the custom properties, select the text tool, and then follow these steps:

  1. Type the following:

    Cost: $
    Follow steps 1 through 4 in the "A simple example" section earlier in this article. Then press ENTER.
  2. Type the word:

    Duration:
    Follow steps 1 through 4 again and enter the Custom Formula as Prop.Duration. Then press ENTER. If desired, type in the time frame such as "week."
  3. Type

    Resources:
    Follow steps 1 through 4 again and enter the Custom Formula as Prop.Resources.


    The resulting shape should look similar to figure 1.
 Picture showing Cost: $5000 - Duration: 2 Weeks - Resources: 4
Figure 1

A more complex example: Choosing to display or hide custom properties

The following example shows how to set a right mouse action to display or hide the custom property values on the shape. This example uses the already modified process shape from the previous example.


To see this example, follow these steps:
  1. Scroll to find the User-defined Cell section of the ShapeSheet. If the User-defined Cell section of the ShapeSheet is not visible, click Sections on the View menu, and then examine User-defined Cell.
  2. Create a new row and name it HideProperties. The value and the prompt for this section should remain unchanged.
  3. Add two additional rows to the end of the Actions section of the ShapeSheet.
  4. Add the following formulas or values to this section.
    ActionActionsMenuPromptCheckedDisabled
    2 =SETF
    ("User.HideProperties",0)
    +SETF("Actions.D2",1)
    +SETF("Actions.D3",0)
    Show
    properties
    Show
    custom
    properties
    01
    3=SETF
    ("User.HideProperties",1)
    +SETF("Actions.D3",1)
    +SETF("Actions.D2",0)
    Hide
    properties
    Hide
    custom
    properties
    00
    Note In Microsoft Office Visio 2003 or in Microsoft Visio 2002, you cannot find Prompt in the Action section.
  5. In the Miscellaneous section of the ShapeSheet, type the following cell reference in the HideText cell:
    User.HideProperties
  6. Now, when you right-click the shape, there will be two additional options: Show Properties and Hide Properties. By selecting either option, you can decide whether to display text or to hide text.
  7. If you want to prevent a user from overriding the new formulas by entering text manually into the shape, protect the shape's text against editing by typing 1 in the LockTextEdit cell in the Protection section of the ShapeSheet.
Eigenschaften

Artikelnummer: 254730 – Letzte Überarbeitung: 11.08.2008 – Revision: 1

Feedback