### Author Topic: Group text subshape moves position if master connector is horizontal/vertical  (Read 496 times)

0 Members and 1 Guest are viewing this topic.

#### efowler

• Newbie
• Posts: 6
##### Group text subshape moves position if master connector is horizontal/vertical
« on: August 18, 2022, 09:43:07 AM »
This is my first time dealing with connector groups/subshapes and I'm running into an issue I can't figure out.

I'm wanting to make a double label connector. I've found some online, but I want to make one exactly the way I want it, kind of particular about it. So I created a straight dynamic connector and converted it to a group, then added a rectangle subshape to the group, and adjusted the size to the width/height of the text inside the rectangle. I then position the rectangle at X=0,Y=0, which apparently is relative to the master shape so it should be at the start point of the connector. This works well when the line is at an angle, however when I make the line vertical or horizonal, the rectangle offsets itself from the connector while still showing coordinates X=0,Y=0. See the attached pictures to see what I mean.

Thanks for any help!

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 4477
• Ideas Visio-lized into solutions
##### Re: Group text subshape moves position if master connector is horizontal/vertical
« Reply #1 on: August 18, 2022, 12:53:16 PM »
Visio 2019 Pro

#### Yacine

• Hero Member
• Posts: 3000
##### Re: Group text subshape moves position if master connector is horizontal/vertical
« Reply #2 on: August 19, 2022, 02:10:26 AM »
If you watch the formulas of the connector when being inclined, horizontal or vertical, you'll notice that the formulas for width and height change.
Inclined and horizontal:
width = GUARD(EndX-BeginX)
height = GUARD(5 mm)

Vertical:
width = GUARD(5 mm)
height = GUARD(EndX-BeginX)

Odd enough, it has probably something to do with the way Visio calculates the length.
I also don't know where the 5mm come from. It seems to be neither the grid spacing nor the size of the sub-shape.

Anyway, how to find the right point for the different inclinations of the connector?
I helped myself with a control point, set it to (0,0) and (1,1) and observed that it jumps like the sub-shape does.
So I corrected manually the position of the control point to get the coordinates for the rectangle.

Ending up for the sub-shape with the formulas
PinX = IF(Sheet.1!BeginX=Sheet.1!EndX,Sheet.1!Width*0.5,Sheet.1!Width*1)
PinY = IF(Sheet.1!BeginY=Sheet.1!EndY,Sheet.1!Height*0.5,Sheet.1!Height*1)
for the end point
respectively
PinX = IF(Sheet.1!BeginX=Sheet.1!EndX,Sheet.1!Width*0.5,0)
PinY = IF(Sheet.1!BeginY=Sheet.1!EndY,Sheet.1!Height*0.5,0)
for the begin point

----

Later I checked the links Wapperdude provided, specially the one from John Goldsmith.
He uses an intermediate field with a POINTALONGPATH formula. Certainly a more elegant way, since you can place the label "on" the connector at "any" place.

« Last Edit: August 19, 2022, 02:17:04 AM by Yacine »
Yacine

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 4477
• Ideas Visio-lized into solutions
##### Re: Group text subshape moves position if master connector is horizontal/vertical
« Reply #3 on: August 19, 2022, 02:00:08 PM »
LOL.  I actually excluded the pointalongpath and control point from my thought process.  But, the two can be combined, along with anglealongpath, if desired, to move the label to any desired location.  Here's supplemental reference:  http://visguy.com/vgforum/index.php?topic=8695.msg37997#msg37997
Visio 2019 Pro

#### efowler

• Newbie
• Posts: 6
##### Re: Group text subshape moves position if master connector is horizontal/vertical
« Reply #4 on: August 22, 2022, 09:45:56 PM »
You guys are legends. Thank you!!!