Hide all shapes in a group

B

Blackend

Howcome when i add the geometry table, and set the Geometry1.NoShow the spaes are not hidden - they stay visible.
Is there another way for doing this (all shapes with one setting) ? - except hiding every shape in the group
 
C

Chris Roth [ Visio MVP ]

Are you setting Geometry1.NoShow = True to go invisible?

A nice technique is to use formula referencing, after adding a user cell:

User.Hide = True
Geometry1.NoShow = User.Hide
Geometry2.NoShow = User.Hide
Geometry3.NoShow = User.Hide
....

Or, you can turn off the line and fill patterns:

User.Hide = 0 or 1
FillPattern = Guard(User.Hide)
LinePattern = Guard(User.Hide)

Using Guard will keep the user from destroying your smarts by applying line
and fill formatting from the dialogs and toolbars.

--

Hope this helps,

Chris Roth
Visio MVP


Blackend said:
Howcome when i add the geometry table, and set the Geometry1.NoShow the
spaes are not hidden - they stay visible.
Is there another way for doing this (all shapes with one setting) ? -
except hiding every shape in the group
 
B

Blackend

Hi Chris

I'm not sure i understand you 100%. Let me try and explain my problem in details

I have a group of:
1 Circle
1 Line
1 Text

The group is called Sheet.8, and has a custom property called "Show"

Now for every shape in the group i have to write the following code

Circle: Geometry1.NoShow: =NOT(Sheet.8!Prop.Show)
Line: Geometry1.NoShow: =NOT(Sheet.8!Prop.Show)
Text: HideText: = NOT(Sheet.8!Prop.Show)

If i got 20 shapes in my group - that's a lot of work. I was wondering if there was a more simple way of doing it.

Blackend
 
C

Chris Roth [ Visio MVP ]

Open the VBA window, paste and run this code:

Sub DoIt

' Get selected shape:
dim shp as visio.shape, sub as visio.shape
set shp = ActiveWindow.Selection(1)

' Build formula:
dim f as string
f = "NOT(Sheet.XXX!Prop.Show)"
f = Replace( f, "XXX", shp.ID)

' Apply to each sub-shape:
for each sub in shp.shapes
sub.Cells("Geometry1.NoShow").FormulaForce = f
sub.Cells("HideText").FormulaForce = f
next

End Sub

--

Hope this helps,

Chris Roth
Visio MVP
 
C

Chris Roth [ Visio MVP ]

If you're using VBA, try the following:

Add a user cell like this:

User.Trigger = DependsOn(Prop.Show) + CallThis( "ThisDocument.DoIt" )

Change your sub so that it has a shape argument:

Sub DoIt( shp as Visio.shape)
...
End Sub

Remember to get rid of the shp declaration *inside* of the sub!

--

Hope this helps,

Chris Roth
Visio MVP


Blackend said:
Hi Chris

Yeps - This solves my problems.

I would like to put the code on my Group/shape so everytime i change the
custom property "Show" i run this macro
 

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