More secrets of the Visio Legend shape

I was going to do a full post on the special Legend shape in Visio that can automatically count instances of masters on a page, then I found that my good friend Chris Roth, aka VisGuy, had done one some years ago ( see visguy.com/…/legend-shapes). However, I have some extra information that will assist in getting the functionality to work consistently.

Basically, you can make any Master work with the Legend shape by adding the User.visLegendShape = 2 setting into a Master shape, but there are caveats.

  1. If the name of a Master is changed, then any existing shapes on the page must be re-placed
  2. The BaseID of each Master must be unique
  3. If the BaseID is changed (using NewBaseID), then any existing shapes on the page must be re-placed

To demonstrate this, I used the Good and Bad icon shapes from the Legend Shapes stencil.

This slideshow requires JavaScript.

I then created a new shape and dragged it onto the Legend shape. This action then makes a new Master in the document stencil and inserts the User.visLegendShape row with a value of 2. This new Master name is added to the count in the legend, but the name is incorrect. So, I then edited the name of the master, but the Legend still shows the old name. When I deleted the existing shape instances of the new master, and then re-added them, they then got shown correctly in the Legend shape, with the new name.

In the second test, I duplicated the Good master, which was then automatically named Good.9.

This slideshow requires JavaScript.

Simply adding instances of this to the page merely updated the count for the original Good icon, and no extra line was created. I renamed the Good.9 Master as Excellent (after making the smile bigger!), but the Legend shape did not update still (as expected after the first test). In this case, however, deleting any existing shape instances and replacing them still did not create a new Legend line.

I then checked the BaseID of the Good and Excellent Masters with the Immediate Window in the VBE, and saw that they were identical. I then request a new BaseID for the Excellent master with the NewBaseID property. Then I replaced the existing shapes, and everything worked fine.

This should solve some of the issues that users have found with the Legend shape.

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

davecra.wordpress.com/

Microsoft Office Development, and more...

PowerShell.Amsterdam

Automate, Accelerate, Accurate

johnvisiomvp

Life with Visio and other Microsoft Toys!

Title (Required)

Windows Server Essentials Tips & Tricks

Nilsandrey's Weblog

Just another WordPress.com weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Shapes, Stencils, Drawings Templates, Tutorials, Tips & Developer Info for Microsoft Visio

Hannes's Virtual Earth

Tips & Tricks around Mapping and Cloud Computing

Pluralsight blog

be smart, be clear, be visual ...

%d bloggers like this: