Add Structure to Your Diagrams in Microsoft Visio 2016

  • 1/8/2016

Compare groups and containers

You can use either groups or containers to visually connect a set of shapes. However, the two have key behavioral differences that are likely to lead you in one direction or the other. The diagrams in this topic contain two sets of shapes that will serve to illustrate the similarities and differences. The green shapes on the left in the diagrams are part of a group; the gold shapes on the right are located inside a container.

In the image on the left in Figure 13-1, the arrows and square are grouped with a gold rectangle by using the traditional Visio technique:

  1. Draw a rectangle (or other shape).
  2. Send the new shape to the back of the Z-order.
  3. Select the rectangle and the shapes you want in the group.
  4. Group the selected shapes.
Figure 13-1

Figure 13-1 Shapes are grouped or contained

Prior to the introduction of containers in Visio 2010, this was the only technique for creating a visual association among a set of shapes.

In contrast, the shapes on the right in Figure 13-1 were placed into a container. One difference is immediately apparent: containers are not just plain rectangles; they include both a main section and a heading.

Three additional differences that are not easily captured in a screenshot become obvious when you work with groups and containers in Visio:

  • If you click a shape that is located in a group, you select the group and not the shape. However, if you click a shape in a container, the first click selects the shape. In essence, a group stands between you and its shapes, but a container is invisible as you select shapes.

  • To select a container and not a member of the container, you must click the heading or an edge of the container.
  • As a result of the click behavior described in the preceding bullets, using a bounding box to select interior shapes in a container is easy—just click inside or outside the container, and then drag. However, to select shapes in a group by using a bounding box, you must start the bounding box outside of the group or you will inadvertently drag the group.

Groups and containers share several behaviors. For example, if you move either one, you move all shapes. If you delete either one, you delete everything. Similarly, you can copy and paste either as a unit.

One difference arises when you want to label the collection, however. When you click a group and start entering text, the text appears in the center of the group shape by default. Sometimes this placement is fine, but other times it’s not. The usefulness of the text in a group also depends on the color and style defaults of the theme you’re using.

In the group shown on the left in Figure 13-2, for example, the text is illegible because its default color is too similar to the color of the background shape. You can, of course, use the Text Block tool you worked with in Chapter 3, “Manage text, shapes, and pages,” to move the text, or you can change its color, but that requires extra steps.

Figure 13-2

Figure 13-2 Text in a group can be obscured by the default font color or by the shapes in the group

Clicking a container and entering text, on the other hand, automatically places the text in the heading, as shown on the right in Figure 13-2.

If you drag a shape out of a group, is it still part of the group? What if you drag a shape out of a container?

The upper half of Figure 13-3 shows a double-headed arrow that has been dragged out of the group on the left and another that has been removed from the container on the right. In the lower half of the figure, the group and container have been moved to the right.

Figure 13-3

Figure 13-3 The effects of dragging a shape out of a group and a container

Notice the following:

  • The green arrow moved with the group.
  • The gold arrow remained in a fixed location.

From these observations, you can conclude the following:

  • Dragging a shape from a group does not remove it from the group.
  • Dragging a shape from a container removes it from the container.

Attempting to add shapes exposes a similar difference. In the upper half of Figure 13-4, a circle has been placed on top of the group on the left and the container on the right. In the lower half of the figure, the group and the container have been moved to the right.

Figure 13-4

Figure 13-4 The effects of placing a shape on top of a group and a container

Here are the conclusions you can draw from this:

  • Placing a shape on top of a group does not add it to the group.

  • Placing a shape on top of a container adds it to the container.

The primary lesson from Figure 13-3 and Figure 13-4 is that unlike groups, Visio containers behave like physical containers: if you put an object in, it becomes part of the container; if you remove an object, it is no longer associated with the container.

Figure 13-5 illustrates a final behavior difference: resizing groups and containers produces strikingly different results. In the figure, both the group and the container were stretched by dragging the bottom resize handle downward.

Figure 13-5

Figure 13-5 Resizing a group resizes all subshapes; resizing a container does not affect member shapes

The following table summarizes the key differences between groups and containers.

Action

Groups

Containers

Resize

Contents are resized with the group

Contents are not changed

Select an interior shape

Requires two clicks (unless default group behavior has been changed)

Requires one click

Select interior shape(s) by using a bounding box

Cannot start a bounding box by clicking inside a group

Can start a bounding box by clicking anywhere

Drop a new shape inside

Dropped shapes are not added to the group (unless default group behavior has been changed)

Dropped shapes are added to the container

Drag a shape out

Shape is physically outside the group but remains part of the group

Shape is removed from the container

Enter text

Text is placed in the center of the group

Text is placed in the container’s heading