Visio Guy

Visio Discussions => Programming & Code => Topic started by: vtroia2014 on March 26, 2015, 05:04:54 PM

Title: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 05:04:54 PM
I have a couple of questions.

1)I have a total of two pages in my Visio drawing. On page one there is a rectangle that I drew. On the other page (page two), I want this rectangle to show the exact same way it is shown on page one. If I make a change to the rectangle on page one, lets say that I rotate it to the right, I want the rectangle to show exactly the same on page two. In other words, I want the rectangle on page two to be linked to the rectangle on page one so any changes that are applied to the rectangle on page one will update the rectangle on page two.

I know how to do this with text box data. I used the following formula for that:
SHAPETEXT(Pages[Page-1]!sheet.3!TheText)

However, this will not work for the properties of the shape (size, rotation, etc.). Does anyone know what formula I would use?

2)Also, along these same lines, how do I do this within the same page?

Thanks,

Vince
Title: Re: Linking shape properties from one page to another
Post by: Yacine on March 26, 2015, 05:23:15 PM
Hi Vince, using a background page as location for the original shape isn't an option?
Title: Re: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 05:34:23 PM
I am not using a background page.
Title: Re: Linking shape properties from one page to another
Post by: Yacine on March 26, 2015, 05:39:01 PM
I know, but could this be an option?
Title: Re: Linking shape properties from one page to another
Post by: wapperdude on March 26, 2015, 05:49:22 PM
As far as rotation, or other properties go, it's similar to what you did for the text, but, easier.

For rotation, in the shape that is being slaved to a shape on same page, in the angle cell, enter sheet.3!angle.  If sheet.3 on another page, say page-2, then Pages[Page-2]!sheet.3!angle. Note, this formula gets clobbered if UI is used to change angle.  You can prevent this by adding guard(....) around the formula.  Adding guard() however, prevents UI changes.

HTH
Wapperdude
Title: Re: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 05:50:02 PM
In my situation it is not an option. I don't want the users of the Visio drawing to mess with the background. Besides that, I simplified my question. I actually have several pages that need to reference the original object. I am familiar with backgrounds and don't want to use them in this case.
Title: Re: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 05:54:23 PM
wapperdude. Can I send you the Visio File?
Title: Re: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 06:03:12 PM
Ok. Here is the file. You will see the object on page-1. When you rotate it, it does not show the same on page-2. I used the 'angle' command. Any help would be greatly appreciated.

Thanks,

Vince
Title: Re: Linking shape properties from one page to another
Post by: Yacine on March 26, 2015, 06:15:22 PM
Hi Vince, me again.
The reason I did not want to follow your path is that you named so many properties of the shape to synchronize. You may end with a special shape, where every cell is replicated in the "slave" shapes. That's too complicated... unless, you're really speaking about a very limited number of properties.
And to come back to my original idea. Do you know that background pages can have backgrounds themselves, such as that you can build up drawings consisting of several layers of one foreground and many backgrounds? That would simplify your task.


BTW, neither Wapperdude nor myself can open Visio files above version 2007.
Can you send it as vsd?
Title: Re: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 06:28:08 PM
Hello Yacine,

Thanks. You are right. The background thing would work and I know I could put layers on, but I would really like to do it without going that route. I have attached the .vsd file.

Sorry for taking up so much of your time.

Thanks,

Vince
Title: Re: Linking shape properties from one page to another
Post by: wapperdude on March 26, 2015, 07:00:40 PM
Alas,  Yacine and I are still using V2007, so I couldn't open the vsdx version.  Looks like this version was unmodified.

So, I put the necessary formula into the shape on page-2.  Performs as desired.

I also copied your shape adding one to page-1 and another to page-2.  It will be obvious which are the new shapes.  I then modified the new shape on page-1.  The goal was to not just push the angle into the new shape on page-2, but to also keep the formula from being clobbered by UI plus allow the page-2 shape to be independently rotated.

To do this, I had to add a User section entry, and then use the SETATREF function in the angle cell.  For more info on SETATREF, I refer you to What with SETATREF anyway?, http://visguy.com/vgforum/index.php?topic=6383.0 (http://visguy.com/vgforum/index.php?topic=6383.0)

I used separate shapes so as to keep the simple approach with your original shapes, and the slightly more involved approach with the duplicated shapes.

HTH
Wapperdude
Title: Re: Linking shape properties from one page to another
Post by: Yacine on March 26, 2015, 07:11:54 PM
Sorry for being such a stubborn A***.
I enclose a drawing showing my approach with the background shapes.
But even if you don't like it, it shows how you can synchronize some of the properties of the shapes (width, height, angle and position)


@Wapperdude, I haven't checked your upload yet, but I also thought about your setatref solutions. Guess you synchronized multiple copies at once?
Title: Re: Linking shape properties from one page to another
Post by: wapperdude on March 26, 2015, 07:44:59 PM
I just updated the What's with SETATREF anyway?  using input from this post.  It demonstrates the linking, the preserving of the formula, and the independent UI for the controlled shape.  Plus, there's an example of catenating commands within SETATREF.  Obsessed???  ::)

It's a digression from this topic, so, for more, go to the referenced post.

Wapperdude
Title: Re: Linking shape properties from one page to another
Post by: vtroia2014 on March 26, 2015, 09:37:16 PM
Thanks you guys. I am at work now, but with check this out later. I really appreciate it.

Vince