Click here to Skip to main content
15,918,516 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:
Figure 1[^]
Figure 1 - New Created Master Shapes with used Master Shape

Property Master Shape (Green Box): that is created from the Member Master Shape of the UML Class Stencil (Blue Box).
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.
Figure 2[^]
Figure 2 - Class Master Shape with its Initial Members

The Property Master Shape that is created from Member Master Shape has changed as follows:
I added one Shape Data to it (Figure 3).
Figure 3[^]
Figure 3 - "Shape Data" dialogue box of the Property Master Shape

I added one Data Graphic Item to it (Figure 4).
Figure 4[^]
Figure 4 - "Data Graphic" and "Data Graphic Item" dialogue boxes of the Property Master Shape

I changed the "User.MemberName" Formula in the User-defined cells' section of the ShapeSheet window as follows (Figure 5):
=MID(SUBSTITUTE(TRIM(SHAPETEXT(TheText)),"[",""),1,FIND(" ",SUBSTITUTE(TRIM(SHAPETEXT(TheText)),"[",""))-1)

instead of:
=SHAPETEXT(TheText)

Figure 5[^]
Figure 5 - "ShapeSheet" window of the Property Master Shape

The Object Master Shape that is created from the Plain Container has changed as follows:
I changed the contents of the cells in the User-defined cells' and Events sections of the ShapeSheet window as Figure 6:
Figure 6[^]
Figure 6 - Cells in the User-defined cells' and Events sections of the ShapeSheet window after changing their contents

instead of:
Figure 7[^]
Figure 7 - Cells in the User-defined cells' and Events sections of the ShapeSheet window before changing their contents

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)?
Figure 8[^]
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)?
Figure 9[^]
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)?
Figure 10[^]
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)?
Figure 11[^]
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)?
Figure 12[^]
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?
Posted
Updated 7-Mar-15 6:31am
v3
Comments
RedDk 9-Mar-15 13:10pm    
This a post from here:

http://stackoverflow.com/questions/28877699/new-created-custom-list-shape-doesnt-work-in-microsoft-visio-2013-x64
MRS1989 11-Mar-15 8:45am    
It's for me.
I've asked it in there first :)

1 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).
Figure 1[^]
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.
 
Share this answer
 
v7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900