shapesvisiostencilsshapesheet

New Created Custom List Shape Doesn't Work in Microsoft Visio 2013 x64


Objective:

First, I should say what I want to do, and then I'll describe what I've done to achieve to my Goal in the next (Descriptions) part.

I want to create a Custom List Master Shape from the Plain Container of the Diagram Parts section in the Insert tab of the ribbon. Then, I want to create another Master Shape that can use as the member shape for the Created Custom List Master Shape.

In other words, I want to add my Created Master Shape to my Custom List Master Shape like attaching the Member and Separator Master Shapes to the Class Master Shape of the UML Stencil.

So, I've faced with some problems in achieving to my Goal that I've described them in the next parts.


Descriptions:

I've created some new Master Shapes in a "Visio Stencil (.vssx)" file as follows:

New Created Master Shapes with used Master Shape

Figure 1 - New Created Master Shapes with used Master Shape

  1. Property Master Shape (Green Box): that is created from the Member Master Shape of the UML Class Stencil (Blue Box).
  2. Object Master Shape (Red Box): that is created from the Plain Container of the Diagram Parts section in the Insert tab of the ribbon.

The Property Master Shape is created to use as the member shape in the Object Master Shape like the Member Master Shape to use in the Class Master Shape of the UML Stencil.

Class Master Shape with its Initial Members

Figure 2 - Class Master Shape with its Initial Members

The Property Master Shape that is created from Member Master Shape has changed as follows:

The Object Master Shape that is created from the Plain Container has changed as follows:


Questions:

1st Question:

Why isn't/aren't instance(s) of the Property Master Shape arranged and placed correctly after adding it/them to the instance(s) of the Object Master Shape like adding instance(s) of the Member Master Shape to the instance(s) of the Class Master Shape of the UML Stencil (Figure 8)?

Comparing an instance of the Object Master Shape and one instance of the Property Master Shape with an instance of the Class Master Shape of the UML Stencil and its Initial Members

Figure 8 - Comparing an instance of the Object Master Shape and one instance of the Property Master Shape with an instance of the Class Master Shape of the UML Stencil and its Initial Members

2nd Question:

Why do(es)n't instance(s) of the Object Master Shape add its Initial Members after attaching it/them to the page like adding Initial Members after adding Instance(s) of the Class Master Shape of the UML Stencil to the page (Figure 9)?

Comparing an instance of the Object Master Shape with an instance of the Class Master Shape of the UML Stencil

Figure 9 - Comparing an instance of the Object Master Shape with an instance of the Class Master Shape of the UML Stencil

I've added the following Formula for achieving to this objective; However, I think that it doesn't work:

=IF(LISTMEMBERCOUNT()=0,DOCMD(2270),0)

3rd Question:

Why isn't displayed a Bar in the instance(s) of the Object Master Shape to insert instance(s) of the Property Master Shape like displaying the Bar in the instance(s) of the Class Master Shape of the UML Stencil to insert its Members (Figure 10)?

Comparing an instance of the Object Master Shape with an instance of the Class Master Shape of the UML Stencil for displaying the Bar to insert related Members

Figure 10 - Comparing an instance of the Object Master Shape with an instance of the Class Master Shape of the UML Stencil for displaying the Bar to insert related Members

4th Question:

Why do(es) instance(s) of the Object Master Shape accept instance(s) of All Master Shapes except than only instance(s) of the Property Master Shape, instead of the instance(s) of the Class Master Shape of the UML Stencil that only accept(s) the instance(s) of the Member and Separator Master Shapes of the UML Stencil (Figure 11)?

Comparing an instance of the Object Master Shape that accepts instance(s) of All Master Shapes with an instance of the Class Master Shape of the UML Stencil that only accepts the instance(s) of the Member and Separator Master Shapes of the UML Stencil

Figure 11 - Comparing an instance of the Object Master Shape that accepts instance(s) of All Master Shapes with an instance of the Class Master Shape of the UML Stencil that only accepts the instance(s) of the Member and Separator Master Shapes of the UML Stencil

I've set =USE("Property") for the "User.msvSDListItemMaster" in the User-defined cells' section of the ShapeSheet window; However, I think that it doesn't work.

5th Question:

Why isn't/aren't displayed options for inserting Members on the added instance(s) of the Property Master Shape to the instance(s) of the Object Master Shape like attached instance(s) of the Member and Separator Master Shapes of the UML Stencil to the instance(s) of the Class Master Shape of the UML Stencil (Figure 12)?

Comparing an instance of the Object Master Shape and one instance of the Property Master Shape with an instance of the Class Master Shape of the UML Stencil and its Members for displaying Options of the inserting members on the added members

Figure 12 - Comparing an instance of the Object Master Shape and one instance of the Property Master Shape with an instance of the Class Master Shape of the UML Stencil and its Members for displaying Options of the inserting members on the added members

6th (Final) Question:

Why do(es) instance(s) of the Object Master Shape behave and act like the Container while I've changed its/their Master Object to a List?


Solution

  • Answer of 1st Question:

    This problem always is for don't attend to the "Category" word. In most cases, people don't attend to that word and use the "Shape Master Name" instead of "Shape Category"; however, they're different with each other.

    In my case, I was being entered the Shape Master Name (Property) for User.msvSDContainerRequiredCategories (A semicolon-delimited list of category names. Other shapes must have at least one matching name to be allowed as container members.) and User.msvSDListRequiredCategories (A semicolon-delimited list of category names. Other shapes must have at least one matching name to be allowed as list members.) instead of Shape Category (User.msvShapeCategories = Member).

    Comparing "Shape Master Name" with "Shape Category"

    Figure 1 - Comparing "Shape Master Name" with "Shape Category"


    Answer of 2nd Question:

    For solving this problem, we must be attended to two things:

    First, We must add the shapes that we want to be added them automatically after instantiate the master shape. So, we must add the row(s) for each shape that we want to be added with name User.msvSDListItemMaster[Index] (The name or UniqueID of the master shape to create an instance of for Insert commands. The value must be placed inside a USE() function.).

    As you can see, I want to add only one shape. So, I must change the name of the User.msvSDListItemMaster row to User.msvSDListItemMaster1. If I want to add more shapes in instantiate time, I must add another row like User.msvSDListItemMaster2, User.msvSDListItemMaster3 and so on.

    Second and the last thing, we must add a formula to the "EventDrop" cell of "Events" section. As you can see, I've added it to my Custom List Shape as what mentioned in here and here:

    Specifying an Insertion Shape

    There are several ways to add a shape to a list: dragging and dropping the shape, clicking the blue insertion triangle that appears near the list edge, or right-clicking an existing member and inserting a shape. Clicking the insertion triangle and right-clicking to insert a shape both use the User.msvSDListItemMaster cell to determine what shape to add to the list. The name of the master is placed in quotes inside a USE() function (for example, USE("List member master")). If no shape is specified in User.msvSDListItemMaster, Visio will duplicate an adjacent shape in the list when inserting the shape.

    It is also possible to automatically populate the list with some member shapes when the list is first dropped on the page. To do this, put the following formula in the EventDrop cell of the list, repeating the DOCMD(2270) once for each member to be added:

    IF(LISTMEMBERCOUNT()=0,DOCMD(2270)+DOCMD(2270)+DOCMD(2270),0)

    2270 is the command for inserting before an item in a list (visUiCmds.visCmdListInsertBefore). It is also possible to use 2271, the command for inserting after an item in a list (visUiCmds.visCmdListInsertAfter).

    The problem is for 2270 number. I don't know why it doesn't work; however, when I checked the above-mentioned cell in the "Events" section of the Class Master Shape of the UML Stencil, I saw that have been used 2499 instead of 2270. So, I used that number in my formula, and it worked. If I have more than one shape for User.msvSDListItemMaster[Index] rows, I must add +DOCMD(2499) for every shape after shape 1.


    Answer of 3rd Question:

    This problem will solve if the problem of the 1st question be solved.


    Answer of 4th Question:

    This problem will solve if the problem of the 1st question be solved. As what mentioned in here and here:

    Controlling List Membership

    Lists have their own cells to govern list membership. Use the User.msvSDListRequiredCategories and User.msvSDListExcludedCategories cells to restrict what shapes can become list members. Because lists are also containers, it is possible for shapes to become container members of the list. The standard User.msvSDContainerRequiredCategories and User.msvSDContainerExcludedCategories cells determine this behavior. By default, Visio will attempt to add a shape to a list as a list member, but if that fails it may try to add it as a container member. The difference between a list member and a container member is that only list members will be arranged by the list and affect its size. Shape designers should manage both sets of membership cells to ensure the right results.

    It's better that we use both User.msvSDListRequiredCategories and User.msvSDContainerRequiredCategories rows to get best efficiency.


    Answer of 5th Question:

    This problem will solve if the problem of the 1st question be solved.


    Answer of 6th (Final) Question:

    The answer is (here and here):

    Custom Lists

    Any shape that has a value of "List" for the User.msvStructureType cell is treated by Visio as a list. A list orders and arranges its member shapes automatically. Note that lists are also considered to be containers, and they have similar capabilities such as automatically moving, copying, or deleting member shapes. All of the previously mentioned container cells apply to list shapes.

    Table 1. ShapeSheet container properties

    User.msvSDContainerMargin

          The distance between the container boundary and member shapes.
    

    User.msvSDContainerResize

          The automatic-resize behavior for the shape:
    
    • 0 = No automatic resize.

    • 1 = Expand as needed.

    • 2 = Always fit to contents.

    User.msvSDContainerStyle

          A one-based index value for the current visual style of the container.
    

    User.msvSDContainerStyleCount

          The total number of visual styles that the container supports.
    

    User.msvSDHeadingStyle

          A one-based index value for the current visual style of the container heading.
    

    User.msvSDHeadingStyleCount

          The total number of visual styles that the container heading supports.
    

    User.msvSDContainerLocked

          A Boolean value that prevents membership changes in the container.
    

    User.msvSDContainerRequiredCategories

          A semicolon-delimited list of category names. Other shapes must have at least one matching name to be allowed as container members.
    

    User.msvSDContainerExcludedCategories

          A semicolon-delimited list of category names. Other shapes with at least one matching name are disallowed as container members.
    

    User.msvSDContainerNoHighlight

          A Boolean value that suppresses the container highlighting when member shapes are selected or added to the container.
    

    User.msvSDContainerNoRibbon

          A Boolean value that hides the Container Tools contextual tab in the ribbon for this container.
    

    User.msvSDContainerHeadingEdge

          A string that designates the location of the interior of the container from the perspective of the container heading. Must be "Left", "Right", "Top", or "Bottom".
    

    User.msvSDMembersOnHiddenLayer

          A Boolean value that determines whether Visio severs container relationships when the container or member is placed on a hidden layer. If True, Visio allows relationships to exist on the hidden layer. If False, Visio severs the relationships.