Automatic Behaviors in Visio
Published Aug 26 2018 03:18 AM 1,596 Views
Brass Contributor

First published on MSDN on Aug, 24 2007

Several people have posted in the newsgroups about Visio moving shapes around unexpectedly - particularly when documents are opened or saved.  This random behavior can be infuriating to users.  Perhaps more frustrating is that Visio may continue moving shapes around after the user has "fixed up" their diagram again.  This post looks at automatic behaviors and tries to shine some light on the issues.

 

Connector Routing

Perhaps the most common automatic activity in Visio is connector routing.  Visio ensures that connectors stay glued to shapes when those shapes are moved around the page.  Visio also finds the optimum route for connectors that will avoid other shapes along the path.  Finally line jumps are added to connectors that cross over other connectors.  Historically, crazy connector routing has been a frequent complaint, but routing logic has gotten significantly better over time.  Recent versions of Visio do a pretty good job with routing.  While users may object to the routes chosen, there are very few reports of routes randomly changing in the diagram.

 

 

 

 

 

 

If you are encountering routing issues in your diagram, you might find this earlier post helpful.  You can also reduce the number of situations where connector routes are changed.  Go to Format > Behavior and then the Connector tab and adjust the Reroute property.  Reroute = Never means that Visio will maintain glue but never recompute the route to optimize it.

 

Solution Behaviors

The second type of automatic behaviors involve Visio solutions.  In this case we are referring to the Visio add-ons that provide extra capabilities for individual diagram types.  For example, the Organization Chart solution is responsible for providing features such as dropping subordinates on top of managers, generating a diagram using the Organization Chart Wizard or synchronizing organizations across pages.  You may not think of these capabilities as add-ons because Visio tries to make the functionality seem as integrated as possible with the core diagramming features.

Most frequently we hear about random shape movement with the Organizational Chart and Cross-functional diagram types.  However, users have reported issues with a number of diagrams such as Gantt Charts and Timelines too.  The root cause for random shape movement is that a diagram has solution managing the position of shapes, and something is triggering that solution to make it move shapes around the page.  These solutions get in trouble when they fail to realize that a shape’s current position has been designated by the user and is no longer under the complete control of the solution.

Visio’s solutions that manage the position of shapes on the page can tolerate varying degrees of customization by the user.  Sometimes it is okay for a shape to be in a different location than what the solution wants, and sometimes the solution is not capable of leaving a shape in a different location.  Many problems arise when the user takes additional steps to prevent automatic behavior such as grouping shapes, replacing connectors with regular lines or disconnecting connectors.  This increases the likelihood that the “proper shape arrangement” according to the solution is not at all what the user intends.

 

Remedies for Automatic Solution Behaviors

There are two basic approaches to correcting a diagram that is “misbehaving”.  You can try to make the solution understand the diagram again.  This typically involves removing non-standard shapes and using the ones provided in the template.  It also means restoring connections between shapes using connectors and not lines.  The other approach is to disable the “intelligent” behavior of the solution and work with the diagram using core Visio capabilities only.  Depending on the drawing type and level of complexity in the diagram you may want the second option, although this is a more drastic measure.

For Organization Charts, the typical cleanup is to delete the connections between shapes and then drop each subordinate on top of their manager again.  For Cross-functional Flowcharts, the typical cleanup is to drag each process shape outside the swimlanes and then drag them back in.  Unfortunately, none of these remedies is guaranteed.  There may be no way for a user to correct some situations.

To disable a solution, you need to disable the Persisted Events that get stored in the document and trigger the solution whenever the document is opened in Visio.  Persisted Events can only be managed programmatically or through Visio’s XML file formats.  The Persisted Events tool in the Visio SDK is a great way to modify Persisted Events.  For those looking for something simpler, try pasting the VBA macros below into your document.  Run DisablePersistedEvents to turn off solution behavior for the document.  Run EnablePersistedEvents to turn solution behavior back on.

 

 

 

Public Sub DisablePersistedEvents()

 

 

 

 

 

Dim vsoEvent As Visio.Event

 

 

 

 

 

For Each vsoEvent In ThisDocument.EventList

 

 

 

 

 

If vsoEvent.Persistent = True Then

 

 

vsoEvent.Enabled = False

 

 

End If

 

 

 

 

 

Next

 

 

 

 

 

End Sub

 

 

 

 

 

Public Sub EnablePersistedEvents()

 

 

 

 

 

Dim vsoEvent As Visio.Event

 

 

 

 

 

For Each vsoEvent In ThisDocument.EventList

 

 

 

 

 

If vsoEvent.Persistent = True Then

 

 

vsoEvent.Enabled = True

 

 

End If

 

 

 

 

 

Next

 

 

 

 

 

End Sub

 

 

 

 

 

Conclusion

Visio provides automatic behaviors to make diagrams much easier to create and manage.  When the automatic behavior matches your expectations, Visio feels like a very powerful tool.  When Visio seems to have a mind of its own, it becomes a frustrating application to work with.  The Visio Product Team is definitely interested in your experiences good or bad with the automatic behaviors in the application.  Your feedback helps us understand where we need to improve.

 

 

 

 

Co-Authors
Version history
Last update:
‎Nov 08 2021 04:20 PM
Updated by: