show/hide subordinates in org chart

L

Laurens

Is it possible to do this with code?
This action is very easy to do manually (by right-clicking a shape), but so
far I havent found a way to automate this.

Any hints are appreciated!

Kind regards,
Laurens
 
J

John Goldsmith_Visio_MVP

Hello Laurens,

That should be fairly simple. Have a look at the ShapeSheet of a shape with
this fuctionality and you'll see that the respective Actions row runs a
command in the Org Chart addon:

RUNADDONWARGS("OrgC11",IF(User.ShowSubordinates,"/cmd=HideSubordinates","/cmd=ShowSubordinates"))

.....you just have to ensure that your chosen shape is selected and then call
the command via code.

Have a look at these two posts, the second of which shows how to run
commands in the Org Chart addon:

http://visualsignals.typepad.co.uk/vislog/2008/06/linking-org-chart-images.html

http://visualsignals.typepad.co.uk/vislog/2008/06/using-the-visio-event-monitor-tool.html

Hope that helps.

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
L

Laurens

Hi John

thanks a lot! My final C# code to accomplish the collapsing:

// Deselect all the shapes on the page.

Visio.Window vsoActWin = _visioApp.ActiveWindow;
vsoActWin.DeselectAll();

// Select specific (parent) shape
vsoActWin.Select(Shape, (short)Visio.VisSelectArgs.visSelect);

Application.DoEvents();

// TEST: hide children of emphasised shape
Visio.Addon adn = _visioApp.Addons.get_ItemU("OrgC11");

adn.Run("/cmd=HideSubordinates");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top