Collapsible shapes?

Started by allmhuran, March 30, 2010, 08:13:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


This may be a common question, but if so I'm not sure how to search for it ("collapsible" returned no results).

Let's say I'm building a network/database/application topology. There's a hierarchy to this kind of structure.

Servers contain Database Instances contain Databases; Applications link to databases.

Now, a server may contain a couple of instances, and it is common for an instance to contain several databases. Let's say I have server SRV1, with database instances SQL1 and SQL2. SQL2 contains databases DB1 and DB2. Application MyApp uses database DB1.

What I would like is to be able to expand and collapse SRV1.
In collapsed mode, MyApp would seem to link straight to the SRV1 shape.
Via double click (or etc) on SRV1, the instances SQL1 and SQL2 would be made visible, and MyApp would connect to SQL2, not SRV1.
A double click (or etc) on an SQL2 would make DB1 and DB2 visible. Now MyApp would be connected to DB1, not SQL2.

Critically, I don't want to skip to a different page that just shows the more detailed section. For example, in the fully expanded version, I would still see SRV1, SQL1 and SQL2, DB1 and DB2 all on the same diagram. The app would connect to DB1, DB1 and DB2 would connect to SQL2, and so on.

Is such behaviour possible using standard visio features? Ie, is there a concept of "collapsible" shapes? I assume this can be done using code, but if it can be done directly using properties that would obviously be much easier.



There's no collapsable shape...but, what you want to do might be possible...and, it might all be done in shapesheets...but probably easier in code

What occurs to me is that you'd have to draw all of the connections.  In the default state (the collapsed state), the subordinate shapes would be invisible and so would the connections to them.  Then when you double click superior shape, it would unhide the subordinate, hide the connection that was leading to the superior shape, and unhide the connection to the subordinate. 

Just a thought.

Visio 2019 Pro



I love your menu solution. Great


That's pretty cool, but how was it done?? :D




Yeah, I had a look there and I see code lines, for instance, "=SETF(GetRef(Actions.Row_9.Checked),IF(Actions.Row_9.Checked=1,0,1))"

This is my first look into the shapesheet, so I'm not sure what this is doing. It looks to me like this action will set the checkbox in the menu if the checkbox is checked. Now, that obviously doesn't make much sense in itself, so something else is clearly going on somewhere! This is way beyond my undersanding.


Welcome in the world of shape sheets.
You got here a quite complicated example.
Start smaller.
Here's a reference:


allhuram....that "" simple does the following:

On the item in the drop down (item 9)....if its checked and you gets unchecked (turned off)....if its unchecke and you gets checked (turned on)
The checked cell is used by other user cells and custom props to decide what to do.
For example, say 9th is checked (dont remember what it is in human form)....the hide cell in custm props will look that checked cell to decide show or hide that custom prop.
Aka...allows one to make to subset the custom props shown.....or in other words....context sensitive presentation of custom propoerties.


I found the references in the shape data section of the shapesheet, with code such as "IF(User.menuindex=3,0,1)" for visibility. But I thought custom properties were just text values. It looks like you've made another shape (ie, the subshapes that get shown and hidden) a property somehow. That's the bit I'm not understanding. How do you draw a shape and then assign it as a property of another shape?


trying to give an example.

you have 2 shapes:

shape 1 (sheet.16) has a property: show2, here you put yes/no, or 1/0, doesn't really matter but lets assume yes/no is the value you put in.
shape 2 (sheet.17) is a simple visio  object, take a desktop for instance

you could set the transparency of the desktop depending on the custom property of shape 1.

with shape 2 selected you'd call up it's shapesheet and on the "image section", in the transparency cell you write: =if(STRSAME(sheet.16!Prop.show2,"yes"),0%,100%)
this would cause shape 2 to check the show2 property of sheet.16 (shape 1), and compare it to the value "yes", if it matches, the if function returns 0% (transparency), if it doesn't --> 100% (transparent)

so basically making another shape depend on the properties of another shape is just refering to the other shapes properties, and depending on that input, selecting what you want to set the current shape's values to.

hope it makes sense


Ah yes, that mechanism makes more sense to me. Thank you Aeo, vojo et all.


Think of visio files as spreadsheets and of shapes as parts of these spreadsheets.
You can calculate inside the "region" (eg height=width*2) or "super-regional" (eg height=sheet.245!user.my_very_custom_cell).


Aye, it's not the logic or possibility that had me wondering (I'm a programmer), it was the precise mechanics of how to do it in visio specifically. That's why my first thought was to write some code, but then I wondered if there might be a better way, and it seems perhaps there is! I will have a play around and see how I go. Cheers.


visio mechanics is arcane and obtuse (that is being kind).

that menuindex is used by the custom props invisible cells to decide to show or hide that custom prop (regardess if its a number or text or whatever).
In the custom find numbers, text, fixed lists, etc.
You will also find that a custom prop will actually drive the color of the port shapes   (EN=blue  FC=dark green  SAS=light green   IB=red/pink, etc)

Its been several years since I did these shapes...but I believe they were built of shapes that actually do isometric 3D with variable light source kinds of things
(if not...those shapes are posted here in other forum entries).   Those shapes were based off some June the Second shapes he did for what appears
to be plumbing (I took his shapes...learned a heck of alot...and either added to them or used the knowledge to build things for my IT use).

I wont kid you....using these shapes to show a single simple IBM BladeCenter will balloon the vsd file to several MB.  If you put into PPT, paste special with
emf file type....cant edit after paste but does prevent PPT from crashing.  ;-)