Organize shapes by using lists
A list is a special type of container that maintains its members in ordered sequence. When you drag an object into a list, it takes a specific place before, between, or after existing members. Each list member knows its relative position in the list.
Visio doesn’t provide a list gallery on the Insert tab in the same way that it offers a Container gallery. Consequently, creating a list either requires reusing an existing list shape or having enough technical knowledge to make changes to the ShapeSheet.
This topic explores adding shapes to a list and reordering shapes within a list. The list shape for this hypothetical scenario is called My New PC, to which will be added rectangular shapes that represent the software to load onto the PC. The starting point is shown in Figure 13-12, with the list in the center and the software shapes on either side.
Figure 13-12 A list shape surrounded by candidate members
The software shapes for this example were created with two special attributes:
Each shape displays the name of a software product that is stored as shape data. The shape data value is displayed by using a Visio field.
- Each shape displays its relative position in the list when it is in a list. When the shape is not in a list, it doesn’t display any number. Display of the list position for each shape was accomplished by using two ShapeSheet formulas.
The goal for the example in this topic is to create a list that shows the installation sequence for a new PC. Although you are unlikely to use a Visio list for this specific purpose, this example might stimulate you to think of your own applications for position-aware shapes.
Add shapes to lists
Dragging a shape into a list triggers the same response shown for a container earlier in this chapter: the list is surrounded by a green rectangle, as shown on the left in Figure 13-13. Also like a container, the list displays the green border when any member shape is selected, as shown on the right.
Figure 13-13 List borders illuminate when shapes are being added or are contained
In the real world, it isn’t possible to install Visio without installing Windows first, so Figure 13-14 shows the Windows 10 shape being dragged into the list. On the left, as the Windows rectangle first approaches the list, there are three visual responses:
- The list border turns green.
- A ScreenTip appears, displaying the words Insert Shape.
- A horizontal, orange insertion bar appears below the Visio 2016 shape.
Figure 13-14 New shapes are added to a list in specific positions
The insertion bar is Visio’s way of telling you that the new shape will be added to the list at that specific location.
The image in the center shows the Windows shape positioned partially above the Visio shape, with the result that the insertion bar is now located above the Visio rectangle.
The result of dragging the Windows rectangle above the Visio shape is shown on the right. Notice that the label Windows 10 is now preceded by the number 1 and the digit in front of Visio 2016 has changed from a 1 to a 2.
You can insert new shapes between existing list shapes. In Figure 13-15, the Office 2016 shape is being added before Visio 2016 and after Windows 10.
Figure 13-15 You can insert a shape between existing list shapes
The preceding figures illustrate a key behavior difference between Visio lists and containers: container members can be located anywhere within a container, but list members are always in fixed positions.
Figure 13-16 illustrates another important difference: unlike shapes in a container, list members cannot reside on the border of the list. On the left, the Visio Add-In shape is positioned on the border of the list. Only a small percentage of the rectangle is actually touching the list, and yet releasing the shape at this point causes it to “fly” into the list.
Figure 13-16 Lists do not allow border shapes
Not only can shapes be inserted into specific positions in a list, they can be rearranged within the list. On the left in Figure 13-17, the Visio 2016 shape is being relocated so it will appear above the Visio add-in shape. Notice that each shape is renumbered automatically based on its new list position.
Figure 13-17 List shapes can be dragged to new locations
The example in this section uses a vertical list in which shapes are automatically placed from top to bottom. A Visio list can be either vertical or horizontal and can sequence shapes in either direction within the list. These attributes are controlled by parameters and don’t require writing code, but you can’t change them from the Visio ribbon; you must make changes in the ShapeSheet for the list.
To add shapes to a list
Do either of the following:
- Drag one or more shapes into the list.
- Use the Insert Shape arrow to position a shape where you want it.
Format and size lists
You can adjust most of the same format and size options for a list that you can for a container, with one notable exception: you cannot change the size of a Visio list shape. Visio controls the size by expanding and contracting a list so it is the exact size of its member shapes plus the margin around the shapes.
The Format tool tab described earlier in this chapter provides the following list-related groups and the functions within them:
- Size group You can use the Margins button to adjust the spacing between the edges of the list and the contained shapes. Because Visio controls the size of a list shape, Fit To Container and Automatic Resize are dimmed.
- Container Styles group You cannot change the style of a Visio 2016 list. However, you can change the style of a list created in Visio 2010 by using the Container Styles gallery. This is true even if the Visio 2010 list is located in a Visio 2016 diagram. You can use the Heading Style gallery to choose alternate heading placement and style options.
- Membership group The Lock Container, Select Contents, and Disband Container buttons provide the same functions for lists that they do for containers.