Controling position of Text in connectors

B

BramBsr

When I look at the shapesheet (Controls section, TextPosition row) for a
connector, the text position sometimes specified as an absolute number (ie
"35.345 mm") and sometimes as a function of the connector's dimensions (ie
"Height*.33333"). Is there way way to control this one way or the other?
 
B

BramBsr

OK, I finally got it to work. A brief explanation of what I'm trying to do
might be in order. After the user has drawn a flow chart on my generic
template, the attributes of the shapes are saved in an Access database. The
user can then retrieve the attributes and automatically redraw the flowchart
from the database, exactly as it was when they saved it. One of the problems
I had was placing the text correctly on the connectors. Visio seemed to
place the text in random locations on the page, rather than somewhere on the
connector it was associated with. Here is the code I used to make it work:

DoEvents
objConnector.CellsU("TxtPinX") = rstProcess.Fields("TextPosX")
objConnector.CellsU("TxtPinY") = rstProcess.Fields("TextPosY")

rstProcess.Fields("TextPosX") and rstProcess.Fields("TextPosY") are
recordset fields from the database that hold the X & Y cordinates of the text
block on the connector.

Without the DoEvents command, Visio totally ignored the 2 following
statements. Once I inserted the DoEvents command ahead of the statements, it
worked fine.

I had the exact same problem with getting Visio to redraw the connectors in
the exact same path that the user had originally drawn them in. I saved the
MoveTo and LineTo data from the Geometry1 section in the shapesheet to the
database, but when I tried to write that data back to the cells in the
connector's shapesheet, Visio ignored the statements untill I inserted a
DoEvents command ahead of them.

Does this make sense to anyone?
 
M

Mark Nelson [MS]

I suspect that connector routing is changing the Geometry section after you
write it. For dynamic connectors, Visio assumes that it owns the contents
of Geometry 1 and will make changes as needed. If you are setting a bunch
of Shapesheet cells in your code, Visio probably queues up the fact that the
connector routing needs to be fixed. Once there is a break in the action,
Visio modifies the Geometry section to fix the routing. If your code runs
without a break, you may be setting the geometry only to have it blasted as
soon as your code stops. The DoEvents lets Visio fix the routing first.
Just one hypothesis as to what you might be seeing.

How does this relate to text? On a connector, Visio manages the arrangement
of text as a function of the routing. Thus a change in routing will move
the text block around too.

Your best bet may be to avoid storing and reconstructing connector routes.
Set the properties on the shape up so that Visio automatically provides the
routing style you want. Then Visio can reroute to its heart's content.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top