Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: Jennifer on November 15, 2014, 05:11:13 PM

Title: Background shape that does not show up in foreground page
Post by: Jennifer on November 15, 2014, 05:11:13 PM
Is there a way to have a shape on a background page (such as guides or comments) that is not visible on the foreground pages?
Title: Re: Background shape that does not show up in foreground page
Post by: wapperdude on November 16, 2014, 12:20:01 AM
Are wanting these features to always be visible on the background page but become invisible when you switch to any drawing page?

Wapperdude
Title: Re: Background shape that does not show up in foreground page
Post by: Jennifer on November 16, 2014, 12:48:16 AM
Quote from: wapperdude on November 16, 2014, 12:20:01 AM
Are wanting these features to always be visible on the background page but become invisible when you switch to any drawing page?
Yes, exactly. I want to see them when I am working on the background page so I can leave the proper amount of room for objects that will be placed on the foreground page (or a higher level background page).

What would be really cool is if I could switch them on and off on the foreground page. Maybe I'll try fiddling around with layers.

J
Title: Re: Background shape that does not show up in foreground page
Post by: Jennifer on November 16, 2014, 01:55:20 AM
I assigned all of the guide shapes to a Guides layer. Now I can turn them on and off as a group, but only from the background page. The layer is not transferred to the foreground page, so I can't turn it off from there. I don't see any other way to turn the guides on and off without going to the background layer. It's inconvenient, but workable.

Does anyone have any other suggestions?

Tx, J
Title: Re: Background shape that does not show up in foreground page
Post by: Croc on November 16, 2014, 09:54:18 AM
I can only suggest to add macro  :(
Dim WithEvents win As Visio.Window

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
    Set win = ActiveWindow
End Sub

Private Sub win_WindowTurnedToPage(ByVal Window As IVWindow)
    If ActivePage Is ActiveDocument.Pages("Background-1") Then
        ActiveDocument.Pages("Background-1").PageSheet.Cells("Layers.Visible") = True
    Else
        ActiveDocument.Pages("Background-1").PageSheet.Cells("Layers.Visible") = False
    End If
End Sub
Title: Re: Background shape that does not show up in foreground page
Post by: Yacine on November 16, 2014, 06:51:36 PM
@Croc,
I don't think a macro is necessary.
Just copy a shape assigned to the specific layer to the desired page and the layer is available there.
Opening the layer dialog is as fast as running a macro.
Title: Re: Background shape that does not show up in foreground page
Post by: Croc on November 16, 2014, 08:06:46 PM
QuoteOpening the layer dialog is as fast as running a macro.
No. The macro runs automatically. See the attached file.
QuoteI don't think a macro is necessary.
I agree. If the document contains no other macros, better without them.
Title: Re: Background shape that does not show up in foreground page
Post by: wapperdude on November 17, 2014, 01:02:38 AM
@Yacine: 
QuoteJust copy a shape assigned to the specific layer to the desired page and the layer is available there.
.  This misses the point of shapes being on background page.  The goal I think is to have some guide shapes, notes, etc on the background, but not show up on the drawing pages.

Since Visio has no change active page event available, then macro is the only way to capture such an event and automatically hide / show the shapes in question.  It's easy enough to write shapesheet formulas that control layers on non-active pages, which could be toggled using action menu on each page.  But, it's not automatic, and does require modifying every page to have said implementation, as there is no way to sense when a page change occurs.

Croc's macro looks like the required approach to make this automatic.

Wapperdude
Title: Re: Background shape that does not show up in foreground page
Post by: Yacine on November 17, 2014, 07:06:19 AM
@Wapperdude,
the point I missed, is that even if the layers have the same name on different pages, they are not the same. So basically you can have a "back" layer visible on the background page, but not on the front page.


So that croc's macro makes more sense.


For people preferring shapesheet there is however a workaround.
A simple SETF/GETREF on the foreground page can switch the layer's visibility.
SETF(GetRef(Pages[Background-1]!ThePage!Layers.Visible),NOT(Pages[Background-1]!ThePage!Layers.Visible))


There are two different places where this formula can be implemented: the page itself or a shape placed on this page.
Having it available on the right-click of the mouse is elegant, but it doesn't propagate to duplicated pages. A macro could help writing this formula in the new page.
Having it in a shape is not so elegant, but as easy as dropping a shape from a stencil.


Last but not least, a big disadvantage is the hard-coded name of the background page. Don't know if one could transform the string "Background-1" to the actual page object.

Title: Re: Background shape that does not show up in foreground page
Post by: wapperdude on November 17, 2014, 07:55:37 AM
@Yacine:  At least we're on the same page!   ::)  Pun intended.