News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Impossible text block settings in dimension field

Started by Jennifer, December 24, 2017, 06:45:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jennifer

I am trying to create a dimension line with a text block that has zero border. I am able to do it with a simple text block, but not with a field inserted into the line shape. In the attached screen shot and Visio doc, I try to achieve with a dimension field the same effect that is easily achieved with a simple text block.


  • A simple text block. I can get a zero border by setting the text block margins to zero and the line spacing to 140%, but, of course, it does not update if the line length changes. And why it has to be 140% rather than 0% is another Visio mystery, at least to me.
  • The default field settings have a small top border and a larger bottom border
  • Using the same settings that work for a simple text block have no visible effect.
  • Reducing the line spacing to 120% helps a little.
  • Reducing it to 100% help a little more, but only on the top.
  • Reducing it to 50% make no more difference.
  • Nor does reducing it all the way down to 10%
  • Making the space after negative has no visible effect.
  • Changing the top margin has no visible effect.
  • Text Block tool, only changes the position, not the borders.

Is there any simple way to get a dimension field with a zero border around the text?
Using Visio 2019, part of Office 365 on Windows 10

wapperdude

Mission Possible...

The following gets you as close as possible.  Basically, outsmart Visio.

Select the dynamic connector.  Type in some normal text. Then format the text as you would like it.  Now, use insert field to replace the text with the parameter that you want.  The text highlighting characteristics should remain unchanged.

HTH
Wapperdude
Visio 2019 Pro

Jennifer

That's a clever solution, but, unless I don't understand something, it doesn't solve the problem. And now, having tried your solution, I think I know why. See below.

On Page 2 of the attached Visio doc, I did as you suggested.

Example #1 is a simple, free-standing text block. I am able to get the borders right next to the text because I can select the Text Block tool and move them right up against the text. This is what I would like the attached text blocks to look like.

Example #2 is a line with its attached text block containing literal text (not a dimension). The Text Block tool works quite differently here. It does not affect the border of the background color. It only affects its location relative to the shape.

Example #3 is a copy of #2, but with a field inserted to show the width. Of course, the borders are the same.

Example #4 solves 1 problem by setting the text block to have no background, but not the line runs right through the text making it difficult to read.

It appears there is no way to do what I want to do.
Using Visio 2019, part of Office 365 on Windows 10

Yacine

Hello Jennifer,
Here's a workaround. Use a grouped shape where you handle separately the text field.
The behaviour settings are very well explained in this article: http://www.visguy.com/2009/03/10/evaluate-shape-text-with-evaltext/  (Getting the text input into a subshape)
Letting the text disappear when there is no text is handled by checking if the length of TheText is less than 0.

Cheers,
Y.
Yacine

Jennifer

Here's what I tried using your Visio doc:

First try:

  • Duplicate your group with the "Best regards" text.
  • With the group selected, click Insert | Field.
  • Select Custom formula and fill in: FORMAT(Width,"0.00")&""""
The text block now shows [0.78"], which is the width of the text block, not the line.

Second try:

  • Duplicate your group with the "Best regards..." text.
  • With the group selected, click the line to select that component within the group.
  • With the line shape selected, click Insert | Field.
  • Select Custom formula and fill in: FORMAT(Width,"0.00")&""""
Now I see the new text block hiding behind the "Best regards..." text. Press F2 to open the group text block and delete it. Now the [4.25"] is visible, but with no background. Open the Format Text dialog and add a background. Now the border is back.

Did I do something wrong?


Using Visio 2019, part of Office 365 on Windows 10

Yacine

#5
Try 1 was the right way, ... almost.
Since the text is now a sub-shape its width is no longer the width of the main shape. It has its own width (=textwidth(thetext)).
To insert the width of the parent, you need to know its ID (Displayed for example in the size and positioning window).
The right formula is thus: // FORMAT(Sheet.82!Width,"0.00")&""""  // (in my case the ID is 82).
Yacine

wapperdude

#6
Not at my computer at the moment...but, I think you misunderstood my approach, or, I've misunderstood your reply.

What I was not suggesting was entering normal text into a separate textbox.  Rather, select the dynamic connector and merely type some text, e.g., "MyText".  Quotes not needed.  The connector will display the text,which you can then use text formatting to get it to look as desired.  Once formatted, you should see the text "highlight" border hug the top of the capitals and the bottom of the tail of the "y".  That's as close as it can get.  Now, with the connector still selected, field insert th desired parameter.  The insert will replace "MyText" and the text formatting will retain your changes.

HTH
Wapperdude

Ed.  Looked at your file.  I misunderstood your reply.  Yes.  That is as good as it gets within the context of the dynamic connector.  The text highlight will not snug up against the bottom of letters.  It will always leave room for the "tail".  Yes.  It does look "unbalanced".
Visio 2019 Pro

Yacine

... and the winner is ... a combination of Wayne's and my shape.
W. is right with the idea of leaving the text in the shape. It's just the background that matters.
So here's a new try with the shape as previously prepared, only that the background shape is now without text and the text itself belongs to the parent.
Yacine

wapperdude

Ooops.  I removed my contribution after Yacine's post but before it was actually posted.  Ships crossing in the night.  Realized by making textbox width = textwidth, then grouping is fine and Yacine's approach avoids the double shape issue. 

LOL.
Wapperdude
Visio 2019 Pro

wapperdude

#9
Well, now Yacine's reference to me will seem strange, so here's the post I deleted.  Note, I added two grouped versions, based upon Yacine's development for convenience.

So, for what it's worth, the 1st three shapes are not grouped.  Each consists of independent textbox and "dimension" line.  The textbox is locked to the center of the dimension line by guarding it's PinX and PinY values.  Because these are not grouped, it is necessary to copy both when duplicating.  Initially I was headed down a different path which led to complex textbox width formula.  Changed approach, so that textbox = textwidth.  Basically, same formula that Yacine used.  Never switched to grouping.

I guess the value of the first three boils down to seeing different field insert formulae.  Plus, the third uses a custom line end shape.  Unless, new releases of Visio improved this function, custom line ends are a pain in the neck.   More trouble than they're worth.  Line widths don't track.

Anyway, I vote for Yacine's final solution, again, with the yellow highlight.

Oh, there is one other modification to all of the examples, the textbox height uses a scaling factor that is reasonably consistent with most font types.  This allows the textbox height to adjust with font size changes and font faces and remain relatively close to the top & bottom edges of the text.  There are exceptions, of course.

Wapperdude

Ed.:  just realized that the grouped behavior was not set to 1-D.  Needs to be changed from 2-D behavior.
Visio 2019 Pro

wapperdude

#10
OK.  Too much time on my hands, and can never leave well-enough alone.

Since this is a grouped shape and the desired behavior is select group only, and because different font faces show variations wrt textbox height, it struck me that controlling the textbox height via shape data would be helpful, especially accessing it via a double click.  There are two parameters to work with, and they are interactive in their effect, so, it takes some twiddling.  The first is the scale factor which sets the overall textbox height.  Typically, the value ranges from 0.5 to 0.7.  The second is the line spacing.  This, in effect, changes how the text is centered vertically in the textbox.  Usual value for this application is 140, but ranges upward to 180, depending upon the font. Minimum value is 100.  Remember, the goal is such that the textbox height just "kisses" the upper and lower edges of the font, so the default settings are unacceptable.

The attached has two examples with significantly different font faces and also the effect of the two parameters.

Enjoy!
Wapperdude
Visio 2019 Pro

Jennifer

Quote from: Yacine on December 27, 2017, 10:26:41 AM
Try 1 was the right way, ... almost.
Since the text is now a sub-shape its width is no longer the width of the main shape. It has its own width (=textwidth(thetext)).
To insert the width of the parent, you need to know its ID (Displayed for example in the size and positioning window).
The right formula is thus: // FORMAT(Sheet.82!Width,"0.00")&""""  // (in my case the ID is 82).
Outstanding!  ;D This is very good to know. So now I can have any dimension values displayed in any shape and put them wherever I want.

Thank you very much.

Of course I have a couple of questions: :-[

When the text block is attached to the line, it has several very desirable attributes:

  • It adapts to changes in the line. If it is centered and I change the line length, the text block remains centered.
  • If I duplicate the line, I get an identical line with a new text block.
  • can attach the edges of the text block to the edges of the line, but the background is only for the text.

None of these attributes appear to work with a separate text block. Is there any way to get it to work in the same way?


Using Visio 2019, part of Office 365 on Windows 10

Yacine

Quote from: Jennifer on December 30, 2017, 07:04:15 AM
None of these attributes appear to work with a separate text block. Is there any way to get it to work in the same way?

Why would you want a separate text block?
It has one - BIG - disandvantage: it can't be used as master from a stencil (The dimensioning shape and the text are 2 shapes).
If you make a master of these 2 shapes, you'll get a grouped shape.
Yacine

wapperdude

#13
At the risk of overstepping...

Here is a smart measurement shape.  Well actually three versions, but the last two are of primary interest.  The last two both use control points to control the textbox attritubutes:  position of the box, the box height, box width, and text centering within the box.  The control points act as sliders to either increase or decrease respective values.

Text is entered, and controls are activated from the main shape.  It is a grouped shape.

Wapperdude

PS.:  note, the last shape could have an option to enable/disable line/fill color matching.  Sorry.  New Years Eve, off to have some fun with friends.  Happy New Year!!!
Visio 2019 Pro

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 430 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1250KB.
Tokens: post-login.
Cache hits: 13: 0.00180s for 26,715 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]