Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: abssorb on June 21, 2011, 09:06:45 AM

Title: Make new sheets have existing data from background page?
Post by: abssorb on June 21, 2011, 09:06:45 AM
I'm making a time plan template, I have a shape in the background page with some data which makes the stencil shapes perform some magic.  The template is nearly finished now, but there is one remaining thing which is causing my test volunteers a problem.

The values needed are in user-defined cells in the page properties of background (they get their values from a shape on the page). When a user creates a new page, and references "Background" as the background page (doesn't have a different uname), the new foreground page starts out with no user-defined cells section, but as soon as a shape is added which relies of the values, the page gets the same user-defined cells as background, but the values are all REF().
If we edit the shapesheet of the new page and use something like:
=Pages[Background]!ThePage!User.Master_Date_Start
that's a workaround, but I can't expect template users to do this.

How can I create a value in visio 2003, which is present in the whole file at all times?


Edit: Thanks Paul.
Title: Re: Make new sheets have existing data from background page?
Post by: abssorb on June 21, 2011, 01:01:00 PM
Experimenting, I tried changing the shape so it points directly to the background page.  This then works as before.  I can create new pages, and pull this shape in from the template.  but there is other strange behaviour.

If I save a copy of the file, and then copy the shape between the files (users will do this), the shape breaks and all its references to the Background page become REF().

Also, wierdly, adding this shape to a new page still creates all the old original page references, even though they're not used anymore.

I must be missing something here.
Title: Re: Make new sheets have existing data from background page?
Post by: Jumpy on June 21, 2011, 02:38:52 PM
Some ideas:

a)
You could detect the adding of a new page with VBA and create the needed user cells and set the references to the background page's cells (complicated).

b)
There is a ShapeSheet not only for the pages, but one for the document, too. This could be a stable place for your references.
How that ShapeSheet of the Document is accessed, and how it is referenced, I have to look up myself, because I saw it done only one time in a german forum.

c)
You are right: When a Shape has references to User defined cells in the PageSheet or lies on certain layers or has certain themes or sth., it takes those cells or layer or themes over to new pages or into the stencil (if you place it into a stencil). But in case of PageSheet cells it takes only the name of the cell, or the cell itself with it. Not the value in the cell!!! As to why that is so...?

Title: Re: Make new sheets have existing data from background page?
Post by: vojo on June 21, 2011, 06:46:53 PM
Visio really doesnt do dynamic linking per se so its always going to be a convoluted approach for what you want to do (stitching real time connections)
(IMHO....MS would have been much much better off getting something like that to work - new functions whatever - than to spend time on dubious concepts such as containers).
(Google and others won the visual war....so Visio should play to its strength of information conveyance with good visuals)

you might try the following:
   - Create 2 cells
           user.data = ''
           user.source = "pages[background-1]!sheet.1!user.masterdata"
    - in event drop something like
           eventdrop = setf(getref(user.data), "&user.source&")          // & or + I forget....basically, this peels off the quotes as the user.source passes through this function and set in the user.data cell
                                                                                           // Probably need to play with this some since, in essence, you are taking advantage of bending VISIO formatting rules
                                                                                           // This only has a shot at working because the destination - user.masterdata - is static in user.source

This way the reference to background is always well formatted and applied on drop

Visio 2010 has a more formal approach to rolling your own functions....so maybe that is even a better way to peel off the quotes

If I get some time...I will try to play with this some.
Title: Re: Make new sheets have existing data from background page?
Post by: Jumpy on June 22, 2011, 07:07:44 AM
Looked into using the document:

To open the ShapeSheet of the document, open drawing explorer first.
Select the drawing. Then Open ShapeSheet (right click menu when in developer mode / else via Window->Open ShapeSheet)

Now you can Add cells to it, for example "User.Test"

From every shape or every page in the document, that cell is referenced as:
=TheDoc!User.Test

hth Jumpy