connectors not getting text position handles

Started by perry59, July 29, 2021, 05:33:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

perry59

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
            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)"
what, me worry?

vojo

MS deprecates/changes behavior without telling users all the time.

perry59

#2
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.
what, me worry?