Author Topic: Connection point location based on text width  (Read 2620 times)

0 Members and 1 Guest are viewing this topic.

YossiD

  • Jr. Member
  • **
  • Posts: 58
Connection point location based on text width
« on: December 26, 2012, 02:32:50 AM »
I am trying to create a text shape with a connection point located a fixed distance below the top of the shape (easy) and a fixed distance to the right of the first line of text. I want to use this shape as a master, so the connection point will have to move as the text changes.

The first line is always a one-line paragraph, and it can be shorter than the following lines/paragraphs of text in the shape. I have set the width of the shape to adjust to the text, so each line of text is always a single paragraph (i.e. no wrapping).

I'm using Visio 2003 on WinXP SP3.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3829
  • Ideas Visio-lized into solutions
Re: Connection point location based on text width
« Reply #1 on: December 26, 2012, 12:34:22 PM »
I'm guessing that the 1st line isn't the longest line?

That makes the task difficult:
    a.) Using right justification is unacceptable?
    b.) Using the "len" function won't work because it doesn't have option to work on a per line basis
    c.) There are no 1st line of text trigger events, which makes using a macro difficult.  In fact, I think the text would have to be entered via the macro to get the "active" parsing needed.  That may not be true, but, somehow the macro would have to be triggered to exam the text and find the correct horizontal position for the connection point.

It seems that the more likely approach would be two separate text fields:  1. for the title, and 2. for the rest of the text.  Then you could use the shapesheet functions to evaluate and determine the connection point location.

Wapperdude
Visio 2019 Pro

vojo

  • Hero Member
  • *****
  • Posts: 1523
Re: Connection point location based on text width
« Reply #2 on: December 27, 2012, 01:23:42 AM »
would not it be better to insert a text transform section

So
   connection.x = textpinx <or some other constant offset> + textwidth/2
   connection.y = textpiny <or some other constant offset> + 4mm <or textheight*some scale number>

Might need to play with the constants and scale to get what you want...but I believe this would be the simplest way to do this.

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: Connection point location based on text width
« Reply #3 on: December 27, 2012, 09:27:12 AM »
I can see two different approaches for the text segmentation that Yossi is talking about. The first would be to use character runs for the formatting (which would lead me to investigate the Character and Paragraph formatting of his text) and the multiple text boxes that Vojo suggested (the much easier approach).
al