Author Topic: Hiding shapes by clicking button  (Read 535 times)

0 Members and 2 Guests are viewing this topic.

Zäsch

  • Newbie
  • *
  • Posts: 4
Hiding shapes by clicking button
« on: May 16, 2018, 07:25:28 AM »
Hallo Visio Guys,

I have a rather special request and don't know if my approach could lead to success.
The situation is that I have a visio file including various shapes displaying a structure of applications and servers that generate reports.
Not every report needs every server or app so the idea is to hide the shapes and only display the ones generating the report.
Since the chart itself will continuosly be growing I thouhgt it would be a good Idea to have everything on one page and simply hide the shapes that are not needed for the report selected.
Another idea was to create a new page for every report which has one giant drawback: everytime a shape changes it has to be changed in every single page which is simply too much work.
Yet another idea was to create some kind of excelsheet give each shape a value and make visio generate pages by itself so only the excel sheet has to be updated and every other shape will appear automatically.
Is visio even the right tool for this task?

If anyone has any idea please let me know.

Grüße from Germany
Zäsch!

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2639
    • Paul Herber's website
Re: Hiding shapes by clicking button
« Reply #1 on: May 16, 2018, 10:08:15 AM »
Have a look at layers. Layers belong to a page, and shapes can be members of those layers. The layers can then be made visible or invisible.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3256
  • Ideas Visio-lized into solutions
Re: Hiding shapes by clicking button
« Reply #2 on: May 16, 2018, 01:37:23 PM »
Adding to Paul's comment, you can then add actions to easily toggle the layers on / off.

Wapperdude
Visio 2007 Std

AndyW

  • Sr. Member
  • ****
  • Posts: 314
    • PC Mimic Diagram
Re: Hiding shapes by clicking button
« Reply #3 on: May 17, 2018, 02:02:27 AM »
An alternative to using layers is to build the ability for the shape to be hidden via a cell in its shapesheet, so by code you would have to turn shapes visibility on or off. This can give you more flexibility if the shapes that are in the reports can change or a new report with a different subset of shapes is required.
Live life with an open mind

Zäsch

  • Newbie
  • *
  • Posts: 4
Re: Hiding shapes by clicking button
« Reply #4 on: May 17, 2018, 03:24:43 AM »
Thank you all for your quick answers!
Highly apprechiated.

I will have a look at it and will provide you with the results.

vojo

  • Hero Member
  • *****
  • Posts: 1130
Re: Hiding shapes by clicking button
« Reply #5 on: May 17, 2018, 10:00:13 AM »
if you want to stay away from VBA and use shapesheet, can do these

action = setf(getref(action.checked), if(action.checked, 0, 1)) + setf(getref(geometry1.noshow), if(action.checked, 0,1))

First setf sets the click flag on the shape dropdown
second, turns the shape display on or off

If You don't want to use layers, you could set flags in page shapesheet to turn catagoires of shapes

shape user cell = setf(getref(geometry1.noshow), if(page!user.x = 1, 0,1))

This would check a page user cell as to whether to show or hide all shapes of this categorie.
In essence, this is similar to layers but using some user specific set of categories to trigger on or off.

<obviously, sloppy syntax...but quite doable...use it all the time>

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3256
  • Ideas Visio-lized into solutions
Re: Hiding shapes by clicking button
« Reply #6 on: May 17, 2018, 11:16:26 AM »
Some pros / cons on shapesheet vs vba.
Shapesheet:  avoids macro security issue, is built into Visio.  Disadvantage:  both layers and Gono's methods require some a priori knowledge as to setting each sheet's identity, e.g., assign to specific layers.  Both require this on a per page basis, e.g., layers not global, but per page.  Similarly, Gono's approach also needs per page pre-planning.  But both will work fine once setup.

Macro: security issue biggest obstacle.  Obviously, some code writing.  Most flexible.  Other than writing code, not necessary to do pre-planning.  Could be set such that it ignores selected shapes.  Thus, you select shapes not wanted, run macro, shapes become hidden, generate report, then, unhide shapes.

All three methods can do the task.

Wapperdude
Visio 2007 Std