Author Topic: connectors not getting text position handles  (Read 2769 times)

0 Members and 1 Guest are viewing this topic.

perry59

  • Full Member
  • ***
  • Posts: 249
connectors not getting text position handles
« on: July 29, 2021, 12:33:52 PM »
Not really a code issue, but I created code to "fix" it.
the problem:
when I create a new drawing, or open most existing ones, when I draw a connector in it's shapesheet there are fields created which define a control point for text within the connector (if any). The connector is also black and a bit thick.
I was recently editing some existing drawings and noticed when I drew connectors they looked different, they were very thin blue lines. when I looked at their shapesheets I discovered that there were NO control points for text and no formulas for txt transform!
This is not good! I did come up with a macro (below) to remedy this, although the text is not centered vertically.
This must be something on the document level, but I don't know what it is. The only difference I see in the document shapesheet is that the offending documents have a reviewer section and the "good" ones do not, could that be the cause?
any ideas would be appreciated!
Thanks

code for fixing connectors:
'there is something in document settings that causes connectors to be made without text position handles.
'if thats the case make them
           
Code
 If Not (vsoShape.CellExists("Controls.TextPosition", 0)) = True Then
                rowNum = vsoShape.AddNamedRow(visio.VisSectionIndices.visSectionControls, "TextPosition", 0)
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlX).FormulaForceU = "Width*0.5"
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlY).FormulaForceU = "Height*0.5" 'does not always vertically center text
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlXDyn).FormulaForceU = "Controls.TextPosition"
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlYDyn).FormulaForceU = "Controls.TextPosition.Y"
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlXCon).FormulaForceU = "IF(OR(STRSAME(SHAPETEXT(TheText),""""),HideText),5,0)"
                'vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlYCon).FormulaForceU = "0"
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlGlue).FormulaForceU = "FALSE"
                vsoShape.CellsSRC(visio.VisSectionIndices.visSectionControls, rowNum, visio.VisCellIndices.visCtlTip).FormulaForceU = """Reposition Text"""
            End If
            vsoShape.CellsSRC(visio.VisSectionIndices.visSectionObject, visio.VisRowIndices.visRowTextXForm, visio.VisCellIndices.visXFormPinX).FormulaForceU = "SETATREF(Controls.TextPosition)"
            vsoShape.CellsSRC(visio.VisSectionIndices.visSectionObject, visio.VisRowIndices.visRowTextXForm, visio.VisCellIndices.visXFormPinY).FormulaForceU = "SETATREF(Controls.TextPosition.Y)"

vojo

  • Hero Member
  • *****
  • Posts: 1577
Re: connectors not getting text position handles
« Reply #1 on: July 29, 2021, 01:59:37 PM »
MS deprecates/changes behavior without telling users all the time.

perry59

  • Full Member
  • ***
  • Posts: 249
Re: connectors not getting text position handles
« Reply #2 on: July 30, 2021, 02:20:02 PM »
this we know. but it's not the case here.
I found the problem https://techcommunity.microsoft.com/t5/visio-blogs-archive/where-s-my-text-control-handle/ba-p/237296
thinking about adding code to my startup routine to delete the connector shape from the document stencil.
« Last Edit: July 30, 2021, 02:40:28 PM by perry59 »