Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: Joe7712 on September 05, 2014, 09:44:06 AM

Title: Background Page to Reference Foreground
Post by: Joe7712 on September 05, 2014, 09:44:06 AM
Hello,

Is it possible for a shape in the background page to reference a custom property of the foreground page where it is being used (In the same way that is is possible to retrieve the page number with PAGENUMBER() and page title with PAGENAME())

For example to include the foreground's page custom drawing number (stored in a user cell on the page) on a generic diagram frame being used in the background.

I have looked at trying to use a combination of EVALTEXT or EVALCELL with the page number to retrieve the property but not had any luck so far...
Title: Re: Background Page to Reference Foreground
Post by: Jumpy on September 05, 2014, 11:37:33 AM
Never tried this and fear it won't work:

User Pagename() in the PageSheet of the Background-Page, for example in User.FrontPageName.
In the Shape sth. like =Pages[EvalText(ThePage!User.FrontPageName)]!PageSheet!User.YourCell

Don't now if the second step is aloowed. Eventually you can use SETF to set this formula new everytime yu change pages using Dependson?

User.SetFormula =DEPENDSON(ThePage!User.FrontPageName)+SETF(GetRef(User.MyLocalCell),"=Pages["&EvalText(ThePage!User.FrontPageName)&"]!PageSheet!User.YourCell")
Title: Re: Background Page to Reference Foreground
Post by: Yacine on September 05, 2014, 03:32:46 PM
I think having seen this same question in the forum some while ago.
There has been a long discussion about it.
Sure you can find it.
Title: Re: Background Page to Reference Foreground
Post by: wapperdude on September 05, 2014, 09:55:59 PM
Yes, it can be done.  In the shape on the background page, insert a field something like:  =pages[page-1]!sheet.1!User.MyTxt  where you've named the User row to be MyTxt..

See attached example.

Wapperdude
Title: Re: Background Page to Reference Foreground
Post by: Yacine on September 06, 2014, 07:40:29 AM
Hi Joe,
so I had some time to look at your problem.

It is fact that you cannot reference non-specific page properties on a background page.

Beside page number, number of pages and background, there is only the page name that can be referenced.

Now the funny thing is, that PAGENAME() can be used with text functions. eg instead of just inserting PAGENAME() you can use parts of it. Like Left(PAGENAME(),1), MID(PAGENAME(),2,3) and similar.

If you now go only one step further, you could imagine inserting in a background shape a formula like =INDEX(2,PAGENAME()), where the page name would be a semi-colon separated list (eg. "Page-1;For internal use; Floor 1"). This background shape would then display "Floor 1".

Now you may either edit manually the page name, or set it up by means of a small macro that would collect the values of the custom properties of the page and concatenate them in a semicolon separated list.

Please find enclosed an example demonstrating my explanation.

HTH,
Yacine

PS: I did only find one link and it did not really answer the question: http://visguy.com/vgforum/index.php?topic=1717.msg7510#msg7510 (http://visguy.com/vgforum/index.php?topic=1717.msg7510#msg7510)
Title: Re: Background Page to Reference Foreground
Post by: Yacine on September 06, 2014, 08:06:40 AM
@Jumpy, I always wonder how you can answer questions from memory only.
I'd love to see you solution in an example.
Can you send one?
Title: Re: Background Page to Reference Foreground
Post by: wapperdude on September 06, 2014, 04:06:45 PM
@Yacine, @Jumpy:  I don't think the post is about grabbing pagenumber info, it's about a custom property on the page...which I interpreted as being stored in a shape as either a User cell entry or possibly a data (prop.xxx) entry.  Both of which are retrievable.

Wapperdude
Title: Re: Background Page to Reference Foreground
Post by: Yacine on September 06, 2014, 04:42:58 PM
Hi Wayne,
you may be right, but Joe wrote
Quote(In the same way that is is possible to retrieve the page number with PAGENUMBER() and page title with PAGENAME())

As this is much more challenging, I concentrated on this aspect. Please check my upload.

If on the other hand it is just a matter of drawing number, then best is to implement it directly on the background page. There's no need to make it more complicated than necessary.

Cheers,
Y.
Title: Re: Background Page to Reference Foreground
Post by: wapperdude on September 06, 2014, 05:26:21 PM
Just making sure that Joe understands we're addressing two different issues.

Not sure, but, this might be the topic you originally had in mind.  Somewhat related to this topic.  It deals with off page connectors and showing the name of the target page:   page name in different page   http://visguy.com/vgforum/index.php?topic=5518.msg22083#msg22083 (http://visguy.com/vgforum/index.php?topic=5518.msg22083#msg22083)
Title: Re: Background Page to Reference Foreground
Post by: Joe7712 on September 10, 2014, 01:27:46 PM
Thanks for all of the responses, just to clarify I was looking at a solution that would a display a custom property of the foreground page in the "background" (using a single background page). So each foreground page would have a User.MyTxt property with a different value, that would be displayed in the background.

Yacine's solution of using the page name to hold the additional information seems to be the best fit so far using =INDEX(2,PAGENAME())

Not been able to get Jumpy's solution to work.
Title: Re: Background Page to Reference Foreground
Post by: AndyW on September 10, 2014, 01:37:45 PM
You could catch the WindowTurnedToPage event and transfer your data from the foreground page to your shape. I use this event to share a background page across several foreground pages and resize a shape to match the foreground page size.
Title: Re: Background Page to Reference Foreground
Post by: Joe7712 on September 18, 2014, 04:14:30 PM
Slight alternative to Yacine's solution using the page number and a single list of parameters stored in the background page attached to this post.
Title: Re: Background Page to Reference Foreground
Post by: Yacine on September 18, 2014, 04:19:19 PM
Nice job, but one shouldn't change the page order ;)