Working with Groups

3 4

When you want to be able to move several shapes together as a unit, the simplest thing to do is group them: select the shapes, and then press Shift+Ctrl+G. When you want to ungroup a group, press Shift+Ctrl+U. (Or use the commands on the Shape, Grouping menu.) That might be all you need to know about groups. However, Visio groups are actually quite smart, meaning they have editing and behavior options that you can control. Moreover, many Visio shapes are groups, as Figure 22-22 shows, and these groups have been designed with special behavior that affects the way you select and format them. So if you want to know savvy techniques for revising existing groups, or all the ways to create and control your own groups, read on.

figure 22-22. many visio master shapes are groups. these master shapes were made by grouping several differently formatted shapes to create a single, easy-to-use object.

Figure 22-22.  Many Visio master shapes are groups. These master shapes were made by grouping several differently formatted shapes to create a single, easy-to-use object.

Because a group is an object, it can include attributes that are independent of the shapes in the group. For this reason, you might want to create a group in the following situations:

  • You want a single object whose parts are formatted differently. In a group, each shape can have different styles and formats applied to it while still moving and sizing together as a group. For example, the Title Block Corporate 1 shape from the Borders And Titles stencil is a group with multiple text shapes. Because it is configured this way, the title can appear in a large font in one text box, the file details can appear in a smaller font in a different text box, and the whole title block can work as a single object.
  • You want a to keep several shapes together. A group unites shapes in your drawing while retaining the ability to work with each shape independently within the group. Shapes in a group can be subselected, and then moved, resized, or rotated.
  • You want an object whose component parts can be reconstituted if necessary. You can always ungroup a group to restore its original shapes; however, the original shapes used during a shape operation such as the Combine command cannot be recovered.

Note


You can create a group using more than just shapes. A group can be any combination of shapes, guides (the blue lines you drag out from the rulers), other groups, and objects from other programs.

There are also programmatic reasons for creating a group. When you group shapes, references to the group are inserted into each shape's ShapeSheet. You can define shape formulas for each shape as well as for the group, and you can make the shape and group formulas interdependent. For example, a shape formula can specify unique sizing behavior as a function of the group size. When you ungroup shapes, the group's ShapeSheet is discarded, which breaks any custom formulas that refer to the group.

InsideOut


Technically, a group is a separate type of object in Visio. Each shape in a group is represented by a ShapeSheet, and the group too is represented by a ShapeSheet. The group's ShapeSheet stores attributes and behaviors of the group, but not of the shapes in it. For example, when a group is resized, its behavior is a property of the group, and the setting that controls sizing is stored in the Group Properties ShapeSheet section.


Troubleshooting

Visio displays a message when ungrouping.

When you ungroup certain shapes that came from a Visio stencil, the following message appears:

The explanation for this message is rather technical, but the short answer is to click OK if you're really sure you want to ungroup the object.

Here's the long answer: every time you drag a master shape from a stencil onto the drawing page, you create an instance of the master. The instance—that is, the shape you see on the drawing page—remains linked to its master and inherits formulas from the master. That way, if you have 100 instances of the same master in a diagram, which could easily happen in a diagram such as an organization chart, the formulas used to create that shape are stored in only one place, which makes for smaller file sizes. When you ungroup a group, you're destroying the object (the group) that is linked to the master. If that object no longer exists, Visio obviously can't link it to anything, and so the warning message appears.


Identifying Groups

It's easy to confuse groups and merged shapes, those complex shapes that result from using a shape operation command. To verify that a shape is really a group, select the shape, and then choose Format, Special. If you see Group in the Type field, it's a group, as Figure 22-23 shows.

Here are some other ways to tell whether an object is a group:

  • Select the object, and then choose Format, Behavior. If the options under Group Behavior appear dimmed, the object is not a group.
  • Select the object, and then press Shift+Ctrl+U (Ungroup command). If you can ungroup it, it was a group. (You can also ungroup certain types of imported objects, such as metafiles, to convert them to Visio shapes.)
  • Select the object, and then choose Window, Show ShapeSheet. If it's a group, you'll see the Group Properties section when you scroll down.

figure 22-23. one sure way to identify a group is to use the format, special command and inspect the type field.

Figure 22-23.  One sure way to identify a group is to use the Format, Special command and inspect the Type field.

Editing Shapes in a Group

You can subselect a shape in a group by double-clicking it, and then move or format the shape while retaining its group membership. When you subselect a shape, the selection handles have small ×s, as Figure 22-24 shows. If the shape is locked, padlock handles appear instead, and you might not be able to format or reposition the shape depending on the type of lock that's been set.

You can add a shape to or remove one from an existing group with a single command, so you don't have to ungroup and regroup. Table 22-2 summarizes how to edit shapes in a group.

Table 22-2. Techniques for Editing Shapes in a Group

Task Technique

Edit shapes in a group

Select the group, and then click a shape in the group to subselect it. Format or move the subselected shape or its text.

Add a shape to a group

Select the shape and the group, and then choose Shape, Grouping, Add To Group.

Remove a shape from a group

Subselect the shape you want to remove from the group, and then choose Shape, Grouping, Remove From Group.

figure 22-24. depending on a group's behavior settings, you can subselect an individual shape that is a member of a group to edit or move it.

Figure 22-24.  Depending on a group's behavior settings, you can subselect an individual shape that is a member of a group to edit or move it.

Subselecting Shapes in Locked Groups

What if you can't subselect a shape in a group? Some Visio groups are set to prevent subselection, but you can reset this option as follows:

  1. Select the group, and then choose Format, Behavior.
  2. In the Group Behavior area, check the setting in the Selection list. If Group Only appears, the group has been protected to prevent subselection.

  3. Change the Selection option to Group First or Members First, and then click OK.

For details about the behavior options for groups, see "Controlling Shape Behavior in Groups."


Troubleshooting

When you subselect a shape in a group, you can't reposition the shape.

Tucked into a group's ShapeSheet spreadsheet is an option that prevents you from moving the group's component shapes, or "children" as the option refers to them. The only way to reset this option is to edit the group's ShapeSheet settings as follows:

  1. Select the group, and then choose Window, Show ShapeSheet.
  2. Scroll down until you see the Group Properties section, which includes a cell labeled DontMoveChildren in the right column. If the value of this cell is TRUE, you've identified the problem—the group is locked to prevent shapes from moving.

  3. Click the DontMoveChildren cell (not the label), type FALSE, and then press Enter.

Editing Locked Groups

If you edit the groups that come with Visio stencils, you will probably encounter the message shown in Figure 22-25. Visio displays this message when a group is locked to prevent ungrouping.

figure 22-25. when a group is locked, this message appears when you try to ungroup it.

Figure 22-25.  When a group is locked, this message appears when you try to ungroup it.

Group behavior and protection options can be set to prevent you from taking certain actions, but these protections are designed to make the group work the way you expect (or the way the shape designers think you expect it to work). Protection settings prevent you from accidentally resetting any SmartShapes formulas the group might include. For example, the 3-D Box shape on the Blocks stencil is a group with a control handle that lets you adjust the box's depth. The shape is locked so that you can't ungroup it, because doing so would remove the control handle's built-in behavior. This option to lock a group is found only in the ShapeSheet window, so to change the lock, you must edit the group's ShapeSheet settings.

InsideOut


When unlocking groups, one caveat applies: groups are typically locked for a good reason. To be on the safe side, make a copy before you ungroup or unlock a protected group. If you're working with a group that came from a Visio stencil, remember that you can always restore the group from the stencil if there's a problem.

Follow these steps to unlock a locked group:

  1. Select the group, and then choose Window, Show ShapeSheet.
  2. Scroll down until you see the Protection section, which includes a cell labeled LockGroup in the right column.
  3. Click the LockGroup cell (not the label), type 0, and then press Enter.

You have now changed the value of the LockGroup cell from 1 (or true, meaning that the group is locked) to 0 (or false, meaning that it's no longer locked). Now you can close the ShapeSheet window and ungroup the group by pressing Shift+Ctrl+U.

Editing Locked Shapes in a Group

Often, a shape in a group will be locked against moving or resizing. When you subselect a locked shape in the group, padlock handles appear around the shape, and you can't resize it. For example, the lid of the Scanner shape is locked to prevent you from changing its width and height or from rotating or deleting it, as Figure 22-26 shows.

figure 22-26. when you select a group and see padlock handles, it's your clue that protection locks have been set. to change the locks, choose format, protection.

Figure 22-26.  When you select a group and see padlock handles, it's your clue that protection locks have been set. To change the locks, choose Format, Protection.

Follow these steps to unlock a shape in a group:

  1. Select the group, and then click the shape to subselect it.
  2. Choose Format, Protection, and then clear the Width, Height, or other check boxes that you want to unlock. Click OK.

Editing in the Group Window

Sometimes it's easier to edit grouped shapes when you work in the group window, in which Visio displays a group as if it were an entire drawing of independent shapes, as Figure 22-27 shows. The shapes are not rotated in the group window even if the group is rotated on the drawing page, so you can more easily align shapes with the grid, guides, and rulers. You can select and edit the shapes individually in the group window by using the same menus and tools as in the drawing window. As you make changes in the group window, the group is updated immediately on the main drawing page.

figure 22-27. you can switch between the group window and the main drawing page by clicking the title bar of the window in which you want to work.

Figure 22-27.  You can switch between the group window and the main drawing page by clicking the title bar of the window in which you want to work.

Follow these steps to display a group in the group window:

  1. Select a group, and then choose Edit, Open Group. If the group has a name, the command replaces Group with the group's name; for example, Open Interstate.
  2. Select and edit the shapes as you would if you were working on the drawing page. As long as the group window is active, the commands apply to the shapes in that window.
  3. To save your changes and return to the drawing window, click the Close button for the group window.

Repairing a Group's Alignment Box

For a group, the alignment box is the selection rectangle that usually surrounds the group tightly. If you reposition the shapes in a group, however, the alignment box's
dimensions might not match the group. You can quickly reset its size to fit the group's new dimensions.

Follow these steps to reset an alignment box:

  1. Select a group.
  2. Choose Shape, Operations, Update Alignment Box.

InsideOut


The purpose of the alignment box is to make a shape easier to align to the grid or other shapes. For some shapes, the alignment box doesn't match the shape's outline, because that's how the shape should align in that diagram type. For example, the Bridge shape on the Road Shapes stencil is a 1-D group with a customized alignment box that makes it easier to connect the shape to road shapes.

Controlling Shape Behavior in Groups

If you want to know why a Visio-made group acts the way it does, or if you want to design your own groups, you can investigate the group behavior options. Group behavior includes the way shapes in a group are resized when a group is resized, the order in which shapes can be subselected in a group and whether they can be subselected, and other rather esoteric options designed with professional shape programmers in mind.

To define the behavior for a group, select the group, and then choose Format, Behavior. The Behavior tab of the Behavior dialog box includes options that apply to groups, as Figure 22-28 shows.

figure 22-28. the group behavior settings in the behavior dialog box are available only when you select a group.

Figure 22-28.  The Group Behavior settings in the Behavior dialog box are available only when you select a group.

The sections that follow tell you which options to use, and when.

Controlling How Shapes Are Sized in Groups

The Resize Behavior options are useful when you're working with shapes that represent real-world objects. You probably wouldn't need these settings in a flowchart, but an office layout is another matter. The classic example used in Visio documentation is a kitchen countertop with appliances. You can group the appliances and countertop so that you can move them around as a unit in your house plan. You can even resize the group because you want the countertop to be longer. However, you wouldn't want the shapes in the group—the stove and sink—to stretch out of proportion. They represent industry-standard sizes. Table 22-3 describes the options.

Table 22-3. Resize Shape Behavior Options for Groups

Option Description

Scale With Group

This setting means that shapes are sized proportionally when the group is resized.

Reposition Only

This option specifies that the shapes are repositioned as the group is resized; the individual shapes do not change in size (as in the kitchen countertop and appliances example).

Use Group's Setting

This option is the default for most Visio shapes and specifies that the shape will behave as the group is set to do when resized.

Controlling How Shapes Are Added to Groups

Among the intriguing things you can do with groups is specify whether new shapes
can be added to a group, and how. You can quickly add a shape to an existing group
by selecting both the shape and group, and then choosing Shape, Grouping, Add To Group. However, you can set a behavior option that allows you to drag shapes onto a group to become part of the group. You can also prevent this behavior. Table 22-4 describes the options in the Behavior dialog box for controlling group membership.

Table 22-4. Add Shape Behavior Options for Groups

Option Description

Add Shape To Groups On Drop

When selected, this option lets you drag a shape or group on top of another group to make it a member of the group. For this to work, though, the group you're adding to must have the Accept Dropped Shapes option selected. This option appears in the Miscellaneous section.

Accept Dropped Shapes

When selected, this option allows a group to accept as a member a shape or group that you drag on top of it, provided that the Add Shape To Groups On Drop option has been selected for the prospective member shape. This option appears in the Group Behavior section.

Controlling How Shapes and Groups Are Selected

When you click a group, what happens? The Behavior dialog box provides options that let you determine the answer to this question. Most of the time, when you click a group, the group is selected. You click again, and one of the shapes in the group is subselected. However, selection behavior doesn't have to work this way. Some Visio groups are set so that you can't subselect the component shapes. For example, the Bridge shape on the Roads stencil includes this behavior, because the group doesn't contain any shapes you're likely to want to edit. Table 22-5 describes the options in the Behavior dialog box that control how groups and shapes are selected.

Table 22-5. Selection Behavior Options for Groups

Option Description

Group Only

When selected, this option means that no matter how many times you click a group, you'll select only the group. You cannot subselect shapes in the group. If you clear this check box, you can subselect the group's shapes.

Group First

When selected, this option specifies that the first time you click a group, the group is selected. The second click selects the shape you're pointing to. This is the behavior you encounter most of the time with Visio shapes.

Members First

When selected, this option specifies that the first time you click a group, the shape you're pointing to is selected. The second click selects the group if you're pointing to the group's bounding box; otherwise, the text insertion point appears in the shape. This setting is useful when the priority is access to the shapes in a group.

Controlling Group Text and Display

Because a group is an object, it has properties, including text, that are independent of the shapes in the group. Visio shape designers often take advantage of this fact to create master shapes that are easy to type in. For example, most network equipment shapes are groups that include a label. To make sure the label displays properly, the group is set so that its text box appears in front of the other shapes in the group. Table 22-6 summarizes the options for controlling the display of group attributes, such as text.

Table 22-6. Group Behavior Options

Option Description

Edit Text Of Group

This check box lets you control whether or not you can edit the text of a group.

Hide

This option in the Group Data list hides a group's text. You can type in a group for which this option is selected, but the text won't appear on the screen. The text is stored with the group and reappears if you choose a different behavior. This option makes it easier to type in shapes with multiple text boxes and makes it more likely that the text will end up in the right place. The Hide option does not hide a group's connection points or control handles.

Behind Member Shapes

This option in the Group Data list places the group's text behind the other shapes in the group.

In Front Of Member Shapes

This option in the Group Data list is the default used by most Visio shapes and places the group's text in front of the shapes in the group.

Controlling Glue in Groups

Some groups are designed to be connected to other shapes. For example, a door in an office layout is a group that you can connect to a wall, which is another group. When you create a group, you can control whether the component shapes in the group can be connected to other shapes or just the group. The default behavior for Visio groups is to enable snapping and glue for the component shapes, but, as in the case of the door and wall shapes, that may not be the behavior you want.

In the Behavior dialog box, the Snap To Member Shapes check box controls group snapping and gluing behavior. When this option is selected, you can connect the shapes in a group to other shapes, and the shapes' connection points are visible. By clearing this check box, you ensure that connectors and other shapes can be glued to the whole group only. Connection points on the group's component shapes are hidden.



Microsoft Visio Version 2002 Inside Out
Microsoft Visio Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612854
EAN: 2147483647
Year: 2000
Pages: 211
Authors: Nanette Eaton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net