Use formulas in the Visio ShapeSheet to add right click menu options that change shape data which in turn change shape attributes or properties (a Visio multi-shape) 

You’ve probably seen those fancy Visio shapes that change their appearance (color, dimensions, etc.) when you select an option in the right click menu. In this post I will show you how to create a shape that will change the fill shape and color based on a right click menu option.

clip_image002

Task 1: Enter a ShapeSheet section and information for Shape Data
  1. Select (single click) the shape to which you will add right click functionality
  2. Open the shape’s ShapeSheet by clicking in the Visio tool bar on Window > Show ShapeSheet
  3. Right click an empty area in the ShapeSheet and click on Insert Section, click the check box for Shape Data then click OK
  4. In case you are not viewing formulas, right click an empty area in the ShapeSheet again and click on Formulas (which will toggle off Values)
  5. The Shape Data section should appear beneath the Shape Transform section

image

Click to view the whole image.

  1. Change the name of the first row from Prop.Row_1 to Prop.Options then enter "Options" for the Label and "White; Green;Yellow;Red" for the Value field
  2. Right click the first row under Shape Data and select Insert Row to create a new Shape Data row
  3. Change the name of the row to Prop.Option, enter "Options" for the label and Prop.Options for the Format (it’s important to NOT have Quotes around Prop.Options in the Format field)
  4. Note: You should now have two Shape Data rows as shown below.

image

Click to view the whole image.

Task 2: Create a section for User-defined Cells and for Actions to handle menu items
  1. Right click an empty area in the ShapeSheet and click on Insert Section, check the boxes for User-defined cells and Actions
  2. In the User-defined Cells section change the row name to User.holdOption and the Value to LOOKUP(Prop.Option,Prop.Option.Format)
  3. In the Actions section right click the first row then select Insert Row – repeat three times so there are four rows
  4. In the first row type in SETF(GetRef(Prop.Option),Actions.Row_1) for the Action and INDEX(0,Prop.Options) for Menu make sure neither of the formulas are surrounded by quotes
  5. At this point you can copy and paste the first rows Action and Menu formulas into the other rows then increment the Row_number and Index number so that it matches the image below

image

Click to view the whole image.

Task 3: Create a formula for the Fill Format that uses the holdOption as a variable to define the shape’s color
  1. In the ShapeSheet scroll down to the Fill Format section
  2. For the FillForegnd cell enter a formula that will change the color of the shape depending upon the value of the holdOption which can now be manually changed from a right click menu – the following formula should work:

=IF(User.holdOption=0,RGB(255,255,255),IF(User.holdOption=1,RGB(0,128,0),IF(User.holdOption=2,RGB(255,255,0),IF(User.holdOption=3,RGB(255,0,0),0))))

Task 4: Insert new Geometry sections that show or hide depending on the value of the holdOption variable
  1. Right click an empty area in the ShapeSheet and click on Insert Section, check the box for Geometry
  2. Change the Geometry2.NoFill cell from True to False
  3. For the Geometry2.NoShow cell enter IF(OR(User.holdOption=0),FALSE,TRUE)
  4. Right click the first row in the new Geometry section and select Insert Row, repeat three times so that you end up with four “LineTo” rows
  5. In the first LineTo row enter Width*1 for X and Height*0 for Y
  6. In the second and third LineTo row enter Width*1 for X and Height*1 for Y
  7. In the fourth LineTo row enter Geometry2.X4 for X and Geometry1.Y1 for Y
  8. Repeat the above steps 3 more times so that you end up with 5 Geometry sections but change the LineTo formulas (to change the dimension of the fill) and formulas for the Geometry.NoShow cells so that they match the image below

clip_image008

Click to view the whole image.

You’re done! Now when you right click the shape you should get menu options for White, Green, Yellow, or Red. The shape should change colors and size of the fill depending on what you select.

Comments
No Comments Available
Add a New Comment
Name

Email Address

Url

Comment


Blog Search
Keywords:
Author:
Posted Between  ...
and  ...