User.msvSDContainerExcludedCategories does not seem to prevent the wrong objects becoming a member of a list.

Hi there,

User.msvSDContainerExcludedCategories does not seem to prevent the wrong objects becoming a member of a list.

I am creating a template for a standard type of drawing on Visio. I would like to create a list with two columns however this is not possible. To get around this I have taken some excellent advice from Scott Helmers and put two lists inside a container instead. This should just about do the trick but almost every time I try to drag and move the container, it ends up accidentally dropping into one of its lists and this messes up the document.

Please see the attached example and tell me where am i going wrong? I bet I've overlooked something very basic?! I have assigned the container the User.msvShapeCategories category of "Cubicle" and then excluded the "Cubicle" category from entering the lists using User.msvSDContainerExcludedCategories.

List-issue.vsd

Thanks for taking the time to look at my problem.

Dan.
Daniel HillAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
As long as you mentioned my name, I thought I'd jump in!

Interestingly, I don't see the problem, by which I mean that every time I drag the container, it behaves properly. There were a few occasions on which it appeared that it was leaving a list behind as I dragged it, but when I let go of the mouse, everything was fine. Can you record a short video perhaps to show the problem? Or describe more completely what's happening, e.g., does the behavior you describe happen every time? Or only sometimes? Does it matter what part of the container you click and drag? Is there any significance to the direction you drag it? Because I am not seeing it happen, I'm grasping at straws a bit.

BTW, here's an unrelated tip: when you have two shapes in a list you see the list text in the background. You can hide the text anytime there is a shape in the list by using this function in the HideText cell -- in case it's useful. (The cell expects true or false and a list count of zero is evaluated as false.)hide text trick
0
Daniel HillAuthor Commented:
Thanks Scott, I have added the hide text rule - good tip.

The video below shows the issue I'm having with the container joining the lists that its containing.

List-issue.mp4

Incidentally I've also realized a problem with using an instance of a this container when I create a master with it, any ideas? This would really prevent me from using this shape as I'd like to in my design template.

Container-Master-issue.mp4

Thanks again.

Daniel.
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Thanks for the video -- that's exactly what I needed. Turns out that the key to making it fail is to click and drag the container on top of the latent image of the list. When I was trying last night I didn't happen to do that,

The good news is that there's a simple answer to prevent the problem: the key is in the paragraph below from this article (emphasis added)

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.

Creating and then setting both
    User.msvSDListExcludedCategories
and
    User.msvSDContainerExcludedCategories
to "Cubicle" does the trick.

Regarding the issue of making a master from your container/list shape -- yeah, that's a problem. I'd forgotten about that but I did have that same issue in my container/list theater seating chart mashup. The challenge is that when you drag anything into a stencil to create a new master, Visio turns the shape into a group. You can verify this by creating the master, dragging an instance onto the page, ungrouping it, and then it will behave properly -- with one notable exception related to z-order: the container/list shape will be "on top" of any shapes that are already on the page. New shapes that you drag from a stencil will be on top of the structured shape, but old shapes you drop on it will disappear behind it.

The only workarounds I can think of: 1) leave an extra copy of your structured shape in the diagram so you can copy/paste when you need a new ones (awkward but functional); 2) write a bit of VBA code that gets executed each time your structured master is dropped onto the page; the code would ungroup the shape and send it to the back.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Daniel HillAuthor Commented:
Excellent, thanks Scott thats done it! I will have a go at the code too, it cannot be that hard to do.
0
Daniel HillAuthor Commented:
Hi Scott,

Just to let you know I found a way around having to code a way to ungroup the container when I drag and drop it from the stencil It was quite simple but took me way too long to figure out.

If you go into the stencil and group the container and its contents, then assign DOCMD(1052) to the group's EventDrop cell. This will ungroup it when you drop it on the page!
0
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Excellent detective work! That's a great idea.

BTW, I fiddled with a couple of ideas yesterday on another question of yours but don't have a good solution. I'll try to get back to it today.
0
Daniel HillAuthor Commented:
Thanks Scott, I look forward to seeing what you come up with.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Visio

From novice to tech pro — start learning today.