locked
Cross Functional Flowchart solution shapes RRS feed

  • General discussion

  • I have been studying container and list shape construction lately and have found the implementation of containers and lists within the Cross Functional Flowchart (CFF) solution to be very instructive.  In this post I am going share what I have learned by breaking down how the different shapes within of the CFF solution fit together.

    For those not yet familiar with containers and lists, the Visio product team has written a couple of great articles on the subject that I highly recommend for anyone wanting to get started in learning how to create their own container and list shapes. 

    Custom Containers, Lists and Callouts in Visio 2010

    http://blogs.msdn.com/visio/archive/2010/01/12/custom-containers-lists-and-callouts-in-visio-2010.aspx

    Container, List, and Callout API in Visio 2010

    http://blogs.msdn.com/visio/archive/2010/01/27/container-list-and-callout-api-in-visio-2010.aspx

    Try this.  Create a new CFF drawing and open the Drawing Explorer.  The drawing that is created contains two swimlanes.  Closer examination using the Drawing Explorer reveals that several shape types are included in the initial drawing:

    ·         CFF Container – the top level container for this solution

    ·         Swimlane List – a “List” container which holds the Swimlane shapes

    ·         Swimlane – one lane in the swimlane solution. It is itself a container so that it captures any shapes added to the swimlane.

    ·         Phase List – a “List” container which holds the Separator shapes.

    ·         Separator – one phase in the CFF solution.  It is itself a container so that it captures any shapes added to the Separator.

    A Container is a new type of shape introduced for Visio 2010 that can be used to “capture” any shapes added to it.  These captured shapes become associated with the container and move with it when the container is moved.  Note that this not the same as grouping.

    A List is a special type of container with all of the same properties of a container, but in addition, it orders its members in either a vertical or horizontal list.  In the CFF solution, when creating horizontal swimlanes, the Swimlane List shape has cell msvSDListDirection=2 which specifies that the list elements are to be ordered Top to Bottom.   In the Phase List shape msvSDListDirection=0.  Its list elements are ordered Left to Right.

    Let’s look at some of the key User cells in each of these shapes.

    ·         CFF Container

    o   User.msvStructureType = "Container"

    o   User.msvShapeCategories = "CFF Container;DoNotContain"

    o   User.msvSDContainerRequiredCategories = "CFF List"

    ·         Swimlane List

    o   User.msvStructureType = "List"

    o   User.msvShapeCategories = "CFF List;DoNotContain"

    o   User.msvSDListRequiredCategories = "Swimlane"

    o   User.msvSDContainerExcludedCategories = "CFF Container;CFF List;Phase;NonCFF"

    ·         Swimlane

    o   User.msvStructureType = "Container"

    o   User.msvShapeCategories = "Swimlane;DoNotContain"

    o   User.msvSDContainerRequiredCategories = ""

    o   User.msvSDContainerExcludedCategories = "CFF Container;CFF List;Swimlane;Phase;NonCFF"

    ·         Phase List

    o   User.msvStructureType = "List"

    o   User.msvShapeCategories = "CFF List;DoNotContain"

    o   User.msvSDContainerRequiredCategories = "Phase"

    o   User.msvSDListRequiredCategories = "Phase"

    ·         Separator

    o   User.msvStructureType = "Container"

    o   User.msvShapeCategories = "Phase;DoNotContain"

    o   User.msvSDContainerExcludedCategories = "CFF Container;CFF List;Swimlane;Phase;NonCFF"

    For each of these shapes User.msvStructureType equals either “Container” or “List”.  One of these values is a must if you want the shape to have the behavior of a container.

    The CFF Container shape requires that for any shape to become a member of this container, it must be defined to be in category “CFF List”.  If you look at the categories defined for the other shapes in this solution, this would include only the Swimlane List and the Phase List shapes.  So even though CFF Container is a container, it will capture no other shapes other than these two.

    Try this. Add a few shapes to the CFF drawing and run the following macro.  The macro lists all shapes that are members of the CFF Container shape.  It will show only the Swimlane List and Phase List shapes as members.

    Public Sub WhatDoesCFFContain()
    'What shapes are members of CFF Container
        Dim shp As Visio.Shape
        Dim members() As Long
        Dim i As Integer
        
        Set shp = ActivePage.Shapes.Item("CFF Container")
        members = shp.ContainerProperties.GetMemberShapes(0)
        For i = 0 To UBound(members)
            Debug.Print ActivePage.Shapes.ItemFromID(members(i)).NameU
        Next
    End Sub

    The Swimlane List shape is defined to be in category “CFF List”.  This allows it to belong to the CFF Container shape.  It requires any contained shapes that are to be treated as a list element to be in category “Swimlane”.  It also excludes shapes in categories “CFF Container”, “CFF List”, “Phase”, and “NonCFF”.  Wait a minute!  I thought we just said only shapes defined in the “Swimlane” category could be members so what is the purpose of excluding shapes in these other shape categories.  Look closely.  User.msvSDListRequiredCategories = "Swimlane" and User.msvSDContainerExcludedCategories = "CFF Container;CFF List;Phase;NonCFF".  This tells me that a shape can be a member of a list as a container member and not be treated as list element.  We will verify this in a moment.

    The excluded categories will prevent the CFF Container, another Swimlane List, a Phase List, a Separator and any “NonCFF” shape from being captured by the Swimlane List. 

    The Phase List shape is defined similarly to the Swimlane List except that it has both User.msvSDListRequiredCategories=”Phase” and User.msvSDContainerExcludedCategories=”Phase”. This means that it will only accept “Phase” category shapes as members and no others.

    The Swimlane and Separator containers can contain any shape except those defined in categories "CFF Container”, “CFF List”, “Swimlane”, “Phase”, and “NonCFF"

    Try this.  Add a shape to one of the swimlanes. Select the shape and run the following macro.  It will display all of the containers that it is a member of.

    Public Sub WhichContainersAmIPartOf()
    'determine which containers a shape is a member of
        Dim shp As Visio.Shape
        Set shp = ActiveWindow.Selection(1)
        
        Dim containers() As Long
        Dim i As Integer
        containers = shp.MemberOfContainers
        For i = 0 To UBound(containers)
            Debug.Print ActivePage.Shapes.ItemFromID(containers(i)).NameU
        Next
    End Sub

     

    The macro will show the shape to be a part of Swimlane List, Swimlane, and Separator.  So a shape other than a Swimlane can be a member of Swimlane List.

    There are a couple of other items which can be gleaned from these settings.  Note that all of the shapes are defined to be in category “DoNotContain”. 

    Try this.  From the ribbon choose Insert > Container and add any of the Visio provided containers to a drawing. Look at the ShapeSheet and see that they all have the cell User.msvSDContainerExcludedCategories=”DoNotContain”.  This means than none of the CFF solution shapes can be captured by any of the Visio supplied containers available on the ribbon.  It also means that if you want to create your own custom shapes that cannot be captured by any of the Visio containers provided in the Container gallery on the ribbon, just define them to be in the category “DoNotContain” by adding the cell User.msvShapeCategories=”DoNotContain”.

    Finally, note that all of the CFF solution shapes exclude shapes in category “NonCFF”.  This means that if you want to create shapes that cannot be captured by any of the CFF solution containers, define them to be in the category “NonCFF” by adding the cell User.msvShapeCategories=”NonCFF”.




    Your comments, questions, or discussion are welcome.

    Fred

    Tuesday, February 16, 2010 2:46 AM