Creating Routable and Other 1-D Connectors

3 4

If you are designing solutions for connected diagrams, you must decide whether your users will use the connector tools built into Microsoft Visio to connect your shapes or to design your own connectors.

The Connector tool, Connect Shapes command (Shape menu), and Dynamic Connector shape create routable connectors between placeable shapes. A routable connector is a 1-D shape that draws a path around other shapes rather than crossing over them on the drawing page. A placeable shape is a shape (usually 2-D) that works with the routable connector. Whether shapes are placeable and routable in a drawing determines how Visio reacts when changes occur, such as when shapes are added, deleted, resized, or repositioned. In response to such changes, Visio automatically repositions shapes that are placeable and reroutes shapes that are routable.

Routable connectors can save users time when they revise complex connected diagrams. In some cases, however, you might want a connector with more predictable behavior—that is, one that does not automatically reroute. For example, if your drawing type requires connecting lines that always form a 90-degree angle or that connect shapes with a curved connector, you can create your own 1-D connector that is not routable.

Creating Routable Connectors

You can create a routable connector from any 1-D line by setting its ObjType cell in the Miscellaneous section to 2.

The value specified in the ObjType cell controls whether objects are placeable or routable in diagrams when users lay out shapes using the Lay Out Shapes command (Shape menu).

The following table provides related values for the ObjType cell.

Values for a shape's ObjType cell

Value

Meaning

0 (or &H0)

Default. Visio decides whether the shape is placeable or routable based on the drawing context.

1 (or &H1)

Shape is placeable.

2 (or &H2)

Shape is routable. Must be a 1-D shape.

4 (or &H4)

The shape is not placeable, not routable.

8 (or &H8)

Group contains placeable/routable shapes. (Reserved for Visio use.)

When you create a new 2-D shape, by default Visio sets its ObjType to No Formula, which evaluates to zero (0), meaning that Visio determines whether the shape can be placeable depending on its context. For example, if you draw a simple rectangle, the value of its ObjType cell is 0 by default. If you then use the Connect Shapes command or the Connector tool to connect the rectangle to another shape, Visio decides that the rectangle can be placeable, and sets the rectangle's ObjType cell to 1 (placeable).

Note


Using the ShapeSheet (r) , you can also create a placeable 1-D shape, which can be beneficial when the shape is not a connector and will be used in a drawing with automatic layout. Setting a 2-D shape to routable, however, has no effect on its behavior.

If you are creating shapes that you do not want to work with routable connectors, set the ObjType cell to 4. Connectors can glue to connection points on the shape, but in a diagram that contains placeable and routable connectors, the nonplaceable shape is ignored—that is, routing lines behave as if the shape does not exist.

To control the path taken by a routable connector, you set its behavior , which corresponds to the value of the ShapeRouteStyle cell in the Shape Layout section. By default, the value of this cell is No Formula, which evaluates to 0, meaning the connector uses the behavior set for the page.

Controlling the layout of connectors

The Lay Out Shapes command (Shape menu) and the Layout and Routing tab in the Page Setup dialog box (click Page Setup on the File menu) provide numerous choices of behavior you can specify for selected shapes or for the page by combining different connector styles with different directions. You can also specify behavior for a shape or the page by setting ShapeSheet cells:

  • For example, setting a connector's ShapeRouteStyle cell to 7 creates a routable connector that always routes as if it's contained in a tree diagram in top-to-bottom orientation. (This is equivalent to choosing Flowchart/Tree for Style and Top to Bottom for Direction in the Lay Out Shapes dialog box under Placement.)
  • To define this behavior as the page default, set the RouteStyle cell to 7 in the page's Page Layout section. (This is equivalent to choosing Tree for Style and Top to Bottom for Direction on the Layout and Routing tab in the Page Setup dialog box).

For details about other settings for the ShapeRouteStyle and RouteStyle cells, search for those cells in the Microsoft Visio Developer Reference (on the Help menu, click Developer Reference).

When you create a template for a diagram that uses routable connectors and placeable shapes, you can customize the default values that Visio uses to route and place shapes. By specifying values with the Lay Out Shapes command (Shape menu), you define the default values for the page. Users can edit shapes on the page to override the page settings; however, when users create or add placeable shapes, by default, the settings for the page are used.

For details about creating diagrams that use routable connectors and placeable shapes, search for "layout" in the Microsoft Visio Help (on the Help menu, click Microsoft Visio Help).

Creating Other 1-D Connectors

When your solution calls for a connector with behavior that you can control programmatically, you can create one that does not automatically route. You can control how a connector extends from its begin point to its end point with formulas.



Developing Microsoft Visio Solutions 2001
Developing Microsoft Visio Solutions (Pro-Documentation)
ISBN: 0735613532
EAN: 2147483647
Year: 2004
Pages: 180

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