Is there any way to hide the text for connectors in a drawing?

Started by PF4VisioGuy, February 07, 2020, 07:38:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PF4VisioGuy

I am automating some visio diagrams (network diagrams)
Because there is no way for me (and it would be cluttered) to add labels and the tail and head end of each connector I put the info in a text in the middle of the connector
Now I am looking for a way to hide that temporarily if I need. Is there any way ? (The connector must remain visible

thanks
PF

vojo

options
A) make the font very small and use actions on the shape to control normal size or really small
    BTW, a variant of this approach allows text to size with shape
B) text "block" on a different layer...from gui, turn layers on and off
C) if text is raw (no text transforms), you can turn and off at geometry level...user shape control to switch on or off
D) could play around with a shape over the text and play with transparency settings to show underlying text or just backround
E) route the text thru a user.cell, use actions for user cell to pick "text" or ""
etc.

All these involve shapesheet actions.  I don't think there is a way to do this on standard UI

PF4VisioGuy

Thanks a lot, very helpful ideas
I think one other way to do it is to leave the text empty and to put the info as comment
My only issue with that is that the tooltip seems to have a hit an miss functionality .... not sure why it either takes its time to show up after I selected the object OR it does not show up at all

Any idea how I can fix that ?


edit: it seems that you need 2-3 seconds of holding the mouse above the shape in order to get the tiptool active

PF4VisioGuy

Quote from: vojo on February 07, 2020, 08:41:29 PM
options

B) text "block" on a different layer...from gui, turn layers on and off
All these involve shapesheet actions.  I don't think there is a way to do this on standard UI

How do I move the text of a standard connector to a different layer ? Is that even possible?
My flow is like this (Python code)
connectorMaster = self.appVisio.Application.ConnectorToolDataObject
connector = self.pagObj.Drop(connectorMaster, 0, 0)
if text!='':
      connector.Characters=text
      connector.CellsSRC(1,17,16).FormulaU='"'+text+'"'    â—„here is where I set the tool tip
connector.Cells("BeginX").GlueTo(shpObj1.Cells("PinX"))
connector.Cells("EndX").GlueTo(shpObj2.Cells("PinX"))

Considering that the connector is a built in object I don't have options to edit it and move the text to a different layer
I have no idea how I can work with other types of connectors

Nikolay

I don't think there is a buit-in function or menu item to hide text on all connectors. If you want to hide shape text programmatically, there is a "HideText" cell as an option.

https://docs.microsoft.com/en-us/office/client-developer/visio/hidetext-cell-miscellaneous-section

connector.Cells("HideText")  = true

Yacine

To add to Nikolay's answer, for hiding related questions I always want to refer to Chris' memorable post about the hidden world of Visio shapes: http://www.visguy.com/2006/09/05/the-hidden-world-of-visio-shapes/
Yacine

PF4VisioGuy

Many thanks to both of you!
That will do it. I can use a template that has the vba code and a button (Hide/Unhide) text
The template will have a sun that gets a lost of all the connectors and it hides/shows their text using hidetext-cell-miscellaneous-section

Yacine

Actually you don't need any VBA at all.

When wanting to switch something page wide you can use the following methode.

Add to the page shapesheet  a custom property "prop.hide_conn_text", set its type to boolean.
Create a connector master in which you set the hidetext field to "thepage!prop.hide_conn_text".
Now you can switch on and off the visibility of all instances of this master.

You can even make the behaviour more sophisticated by providing a "don't care" or "let the connectors decide" mode.
For this functionallity you would change the type of the hiding field to fixed list and provide three values (0,1,2 or hide/show/don't care). Mind that numbers are easier to handle than strings, but strings are more user friendly.
In the connector master you will add a prop field hide_text as boolean
Now in the connector master the hidetext field would be written as "= IF(thepage!prop.hide_conn_text=0,TRUE, IF(thepage!prop.hide_conn_text=1,FALSE,prop.hide_text)).
ie:
- 0 = hide
- 1 = show
- else = show as individually set
This way you can switch the texts on and off globally, but also locally for individual shapes. The global settings override the local ones.

HTH, Y.
Yacine

PF4VisioGuy

Thank you, nice solution
I already implemented the VBA based one after some toying with the code
I will save this to my Visio Automation folder for future references and use

vojo

Ok...I will bite....where is this infamous "hidetext" cell? 
Using the connector tool between 2 squares and then inspecting the connector, I could not find a "hide text" cell

Do you mean set transparency to 100% kind of thing?

Yacine

>:( Bite!
PS:  8) would have been more appropriate.  ;D (no offence meant).
Yacine