Discussion:
Show/hide a group.
(too old to reply)
Geert Vancompernolle
2006-02-15 19:12:05 UTC
Permalink
Hi,

I've created a group of elements (lines, circles,...). This group is put into
(or on top of) an overall group, which has the "accept dropped shapes" property
set. This results in a certain shape.

Now, I want to show or hide that 'subgroup', depending on a choice made in a
smart menu of the overall shape.

One of the possibilities is setting the line pattern to 0.

When I try this by means of the context popup menu, it works (right-click on the
sub-group, select Line..., then Pattern and put the value on 0).

However, when I do the same via the shape sheet, it doesn't work!

Then I tried by playing with the transparency (0% <-> 100%).

Again the same: when changed via the context menu, it's working. When changed
via the shape sheet, nothing happens...

My temp solution is to select all individual lines/circles of the sub-group and
individually set the Geometry.NoShow to true/false, depending on the smart menu
selection.

However, this is overkill and makes it very cumbersome to execute and maintain.

1. Why is there a difference between changes via context menu popup and shape sheet?

2. How can I conveniently show/hide a group?

Best rgds,

--Geert
Mark Nelson [MS]
2006-02-16 05:54:47 UTC
Permalink
When you make a formatting change through the user interface, Visio
automatically applies that change to all sub-shapes of the selected shape.
When you make a change through the Shapesheet Window or automation, Visio
only touches the original shape.

Generally to show or hide sub-shapes, you create a property or cell on the
group shapes that indicates a particular visibility state. Then you add a
formula to the NoShow cell of each sub-shape's geometry section return
either True or False based on the current visibility state.
--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Geert Vancompernolle
Hi,
I've created a group of elements (lines, circles,...). This group is put
into (or on top of) an overall group, which has the "accept dropped
shapes" property set. This results in a certain shape.
Now, I want to show or hide that 'subgroup', depending on a choice made in
a smart menu of the overall shape.
One of the possibilities is setting the line pattern to 0.
When I try this by means of the context popup menu, it works (right-click
on the sub-group, select Line..., then Pattern and put the value on 0).
However, when I do the same via the shape sheet, it doesn't work!
Then I tried by playing with the transparency (0% <-> 100%).
Again the same: when changed via the context menu, it's working. When
changed via the shape sheet, nothing happens...
My temp solution is to select all individual lines/circles of the
sub-group and individually set the Geometry.NoShow to true/false,
depending on the smart menu selection.
However, this is overkill and makes it very cumbersome to execute and maintain.
1. Why is there a difference between changes via context menu popup and shape sheet?
2. How can I conveniently show/hide a group?
Best rgds,
--Geert
Geert Vancompernolle
2006-02-16 16:07:23 UTC
Permalink
Thanks, that's indeed what I've done now, by using a scratch field.

But I thought/hoped it was possible to automatically inherit this on the sub-shapes.
This way, it would save one from selecting each and every sub-shape and set the
Geometry.NoShow field content to the correct visibility state.

But that doesn't seems to be the case, so I'll live with this -can I call it-
restriction. Luckily, in my case there aren't that much sub-shapes, but I can
imagine if you have a complex shape, that can be a different matter.

Best rgds,

--Geert
Post by Mark Nelson [MS]
When you make a formatting change through the user interface, Visio
automatically applies that change to all sub-shapes of the selected shape.
When you make a change through the Shapesheet Window or automation, Visio
only touches the original shape.
Generally to show or hide sub-shapes, you create a property or cell on the
group shapes that indicates a particular visibility state. Then you add a
formula to the NoShow cell of each sub-shape's geometry section return
either True or False based on the current visibility state.
Mark Nelson [MS]
2006-02-17 05:40:19 UTC
Permalink
While this might be a nice feature, I'm not sure why this is difficult to do
through code. You just need to create a little helper function that
iterates through sub-shapes.
--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Geert Vancompernolle
Thanks, that's indeed what I've done now, by using a scratch field.
But I thought/hoped it was possible to automatically inherit this on the sub-shapes.
This way, it would save one from selecting each and every sub-shape and
set the Geometry.NoShow field content to the correct visibility state.
But that doesn't seems to be the case, so I'll live with this -can I call
it- restriction. Luckily, in my case there aren't that much sub-shapes,
but I can imagine if you have a complex shape, that can be a different
matter.
Best rgds,
--Geert
Post by Mark Nelson [MS]
When you make a formatting change through the user interface, Visio
automatically applies that change to all sub-shapes of the selected
shape. When you make a change through the Shapesheet Window or
automation, Visio only touches the original shape.
Generally to show or hide sub-shapes, you create a property or cell on
the group shapes that indicates a particular visibility state. Then you
add a formula to the NoShow cell of each sub-shape's geometry section
return either True or False based on the current visibility state.
Geert Vancompernolle
2006-02-18 07:05:49 UTC
Permalink
Mark,

I'm not so familiar with code behind shape sheets. So far, I could do by only
'programming' fields in the shape sheets.

Is it possible for you to provide me with some example code of how to do this
iteration you're talking about?

Seems quite powerful and maybe that might bring solutions to other problems I
faced (but solved via a 'detour') in other shape sheets.

Best rgds,

--Geert
Post by Mark Nelson [MS]
While this might be a nice feature, I'm not sure why this is difficult to do
through code. You just need to create a little helper function that
iterates through sub-shapes.
Mark Nelson [MS]
2006-02-23 06:54:12 UTC
Permalink
Here is one way to do it:

Private Sub ChangeShape(vsoTopShape as Visio.Shape)

'Do whatever you need to do to the topmost shape
vsoTopShape.Cells("HideText").ResultIU = 1

'Recurse through this shape's subshapes
If vsoTopShape.Type = visTypeGroup Then
VisitAllSubshapes vsoTopShape.Shapes
End If

End Sub

Private Sub VisitAllSubshapes(vsoShapes as Visio.Shapes)

Dim vsoShape as Visio.Shape

For Each vsoShape in vsoShapes

'Do whatever you need to do to the subshape
vsoShape.CellsU("HideText").ResultIU = 1

'Recurse through this shape's subshapes
If vsoShape.Type = visTypeGroup Then
VisitAllSubshapes vsoShape.Shapes
End If

Next

End Sub
--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Geert Vancompernolle
Mark,
I'm not so familiar with code behind shape sheets. So far, I could do by
only 'programming' fields in the shape sheets.
Is it possible for you to provide me with some example code of how to do
this iteration you're talking about?
Seems quite powerful and maybe that might bring solutions to other
problems I faced (but solved via a 'detour') in other shape sheets.
Best rgds,
--Geert
Post by Mark Nelson [MS]
While this might be a nice feature, I'm not sure why this is difficult to
do through code. You just need to create a little helper function that
iterates through sub-shapes.
Geert Vancompernolle
2006-03-04 12:39:55 UTC
Permalink
Thanks!
Post by Mark Nelson [MS]
Private Sub ChangeShape(vsoTopShape as Visio.Shape)
'Do whatever you need to do to the topmost shape
vsoTopShape.Cells("HideText").ResultIU = 1
'Recurse through this shape's subshapes
If vsoTopShape.Type = visTypeGroup Then
VisitAllSubshapes vsoTopShape.Shapes
End If
End Sub
Private Sub VisitAllSubshapes(vsoShapes as Visio.Shapes)
Dim vsoShape as Visio.Shape
For Each vsoShape in vsoShapes
'Do whatever you need to do to the subshape
vsoShape.CellsU("HideText").ResultIU = 1
'Recurse through this shape's subshapes
If vsoShape.Type = visTypeGroup Then
VisitAllSubshapes vsoShape.Shapes
End If
Next
End Sub
Geert Vancompernolle
2006-03-04 12:40:36 UTC
Permalink
Thanks!

--Geert
Post by Mark Nelson [MS]
Private Sub ChangeShape(vsoTopShape as Visio.Shape)
'Do whatever you need to do to the topmost shape
vsoTopShape.Cells("HideText").ResultIU = 1
'Recurse through this shape's subshapes
If vsoTopShape.Type = visTypeGroup Then
VisitAllSubshapes vsoTopShape.Shapes
End If
End Sub
Private Sub VisitAllSubshapes(vsoShapes as Visio.Shapes)
Dim vsoShape as Visio.Shape
For Each vsoShape in vsoShapes
'Do whatever you need to do to the subshape
vsoShape.CellsU("HideText").ResultIU = 1
'Recurse through this shape's subshapes
If vsoShape.Type = visTypeGroup Then
VisitAllSubshapes vsoShape.Shapes
End If
Next
End Sub
Loading...