Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: rickscr on June 05, 2013, 04:34:38 PM

Title: Can't change shape text size
Post by: rickscr on June 05, 2013, 04:34:38 PM
I've created a custom stencil, but then I think I messed up a setting in the shapesheet so that I can not longer re-size the shape text using the Text block tool.  I can't figure out what I did.  I can resize the it by entering the shapesheet and changing the TxtWidth row, but need to be able to use the Text block tool.

Can anyone help?
Title: Re: Can't change shape text size
Post by: John Distai on June 05, 2013, 04:45:26 PM
It resized for me.  I right clicked on the text and resized it using the popup.  Were you doing it some other way?
Title: Re: Can't change shape text size
Post by: rickscr on June 05, 2013, 04:51:35 PM
I'm trying to change the text block size, not the font size.
Title: Re: Can't change shape text size
Post by: Yacine on June 05, 2013, 05:34:39 PM
That's a nice challenging one. I did not find the failure.
Title: Re: Can't change shape text size
Post by: wapperdude on June 05, 2013, 11:40:11 PM
In the shapesheet, scroll down to Text Transform section.  The TxtWidth and TxtHeight are slaved to the shape width and height.  That is effectively locking the text box size.

For more on text issues, see http://msdn.microsoft.com/en-us/library/aa200986(v=office.10).aspx.  It's for V2002, but should be valid for present versions.
Title: Re: Can't change shape text size
Post by: Yacine on June 06, 2013, 06:27:28 PM
Sure, but they are not guarded, thus should respond to manual operation.
Title: Re: Can't change shape text size
Post by: wapperdude on June 07, 2013, 04:50:49 AM
Well, that would seem to be the expected behavior, but it's not.  Try removing the formula.  The textbox will resize manually once you do.

Someone with better visibility into Visio workings can explain it, but, the unguarded formula is blocking the manual resize behavior.

This is probably a candidate for SETATREF function.  Yuk.
Title: Re: Can't change shape text size
Post by: rickscr on June 14, 2013, 04:49:01 PM
That didn't seem to work.  I changed the formulas to 1 inch for each and the textbox resized, but it's still locked somehow when using the text block tool.  This is driving me crazy!  I may just have to rebuild the shape.  :(

I'm on Visio 2007, if that makes any difference.
Title: Re: Can't change shape text size
Post by: wapperdude on June 14, 2013, 06:47:41 PM
I re-tried my steps.  This time, the text box does NOT respond to the text box tool.  Very strange.  It had corrected the 1st time I did this.  Sorry for the misinformation.  (Should've saved that 1st attempt.)

If you put the following formula in the txtwidth box, the box will resize to entered text:  =textwidth(TheText).  To constrain the box width, you could employ the bound functon.

Wapperdude
Title: Re: Can't change shape text size
Post by: wapperdude on June 14, 2013, 07:18:34 PM
It appears that the shape has some corruption.  I duplicated the shape.  Re-confirmed the text box sizing problem.  Ungrouped.  Deleted existing text box.  Re-grouped.  Created control for positioning text box.  Added text.  The text block tool now functions as expected.

Compared both shapesheets.  Did not see anything unusual in either one, certainly not anything that would prevent textbox from resizing. 

Lacking an explanation, recommend taking the above stated steps.  At least you'll have a shape that works.

Wapperdude
Title: Re: Can't change shape text size
Post by: rickscr on June 14, 2013, 07:21:26 PM
Well, looks like I'll be rebuilding the shape and others with the same problem.

Thanks everyone for your help.
Title: Re: Can't change shape text size
Post by: rezingg on July 01, 2020, 04:43:19 PM
Even though this thread is many years old, I thought I'd post, as I just ran into the same (or very similar) situation.
I have a text-box of a shape that won't allow me to resize its width, even though there is no GUARD() in place for TxtWidth.
What I found is if TxtLocPinY contained "TxtHeight", I can't resize the text box width. But if I changed that to "TxtHeight*1" then all is fine!
Not intuitive at all, at least not to me. But it made all the difference.
I hope this helps someone.
Title: Re: Can't change shape text size
Post by: vojo on July 01, 2020, 07:43:46 PM
textheight just defines a box...nothing to do with text size.

for that, use the fontsize cell in shapesheet.

For kicks...make a box shape...add text....change text size on home menu....text changes box stays the same
Title: Re: Can't change shape text size
Post by: wapperdude on July 01, 2020, 10:15:13 PM
@rezingg:  I created a simple shape, basically, as Vojo describes.  And, that behaves as one would expect.  The width remains constant regardless of how much text is entered.  Visio automatically wraps the text and grows the height.  This is standard behavior.  Note, the actual boundaries defining the shape do not change.  The shape can be manually expanded in width and the wrapping will adjust to new width.

Out of curiosity, I modified the TxtLocPinY cell as per your description.  Had no impact upon behavior.  All above remain unchanged.

So, if the behavior you're seeing doesn't match the above, perhaps you can upload an example.  If otherwise, I couldn't replicate any abnormal behavior.
Title: Re: Can't change shape text size
Post by: rezingg on July 02, 2020, 05:23:16 PM
Ok, try this:
1) draw a rectangle
2) use Text Block tool to verify you can change width of text block manually (text block of rectangle is by default size of the rectangle)
3) open ShapeSheet of rectangle
4) change TxtLocPinY from default "TxtHeight*0.5" to "TxtHeight"
5) use Text Block tool on the rectangle and find that you can not change the width of the text box anymore!
6) go back to ShapeSheet and change TxtLocPinY to "TxtHeight*1"
7) use Text Block tool on the rectangle and find that you now CAN change the width of the text box, thanks to adding "*1"!

I'm on Visio Version 1908.

Edit: it appears interactive text block resizing only works if the TxtLocPinY cell content has the format <SomeVariable>*<number>. Any other cell content causes issues, including a number by itself or multiplied by another number.
Title: Re: Can't change shape text size
Post by: wapperdude on July 02, 2020, 05:43:56 PM
Yes.  Confirmed.  But, it's actually worse...

With just TxtHeight:
1) cannot resize, period
2) cannot move text box
3) can use rotation handle to rotate.

If add "/1":  similar bad behavior (no quotes)
If "/2":  still cannot resize, but, can move.

Definitely a BUG.
Title: Re: Can't change shape text size
Post by: rezingg on July 02, 2020, 06:24:57 PM
Quote from: vojo on July 01, 2020, 07:43:46 PM
textheight just defines a box...nothing to do with text size.

for that, use the fontsize cell in shapesheet.

For kicks...make a box shape...add text....change text size on home menu....text changes box stays the same

@Vojo, this relates to the issue OP has observed, not being able to resize the text block with the text block tool. Has nothing to do with text size (subject line is a bit misleading). See detailed description I added to replicated the issue.
Title: Re: Can't change shape text size
Post by: vojo on July 02, 2020, 06:59:02 PM
I guess I am missing the ask
- cant even see a text box
- cant even format it.
So all it will do is force wrap

If the goal here is a box that visible and formattable, then use a shape (rectangle?) and do a group and set:
- group shape to 1D
- disable selection box
- set line to intercept the handles
- Protection ==>VTX = 1
- Protection ==> height = 1

Result will be a line or connector with a box attached for text et al that behaves like a 1D connector.

or

make this
- take a connector
- add a connection point where you want to anchor the text box
- make a rectangle
- in rectangle text box
   - pinx = guard(connector pinx + or - some offset)           // E.g pinx = guard(conn.pinx - width *0.35)
   - piny = guard(connector piny + or - some offset)
           or
   - pinx = guard(connector pinx)
   - piny = guard (connector piny)
   - locpinx = width *1.2
   - locpiny = height *0.3

play around as needed
Title: Re: Can't change shape text size
Post by: vojo on July 02, 2020, 07:00:47 PM
or attached
Title: Re: Can't change shape text size
Post by: rezingg on July 02, 2020, 08:42:27 PM
@vojo, thanks for your effort to find a solution.
However, I'm not really looking for a solution. I found this thread because the OP had the same issue as I had (a shape with a text block that can't be resized interactively using the text block tool). I found what causes this issue (confirmed by wapperdude to be a BUG) and published my findings, so the next person who comes to this thread has a hint what may be causing the unexpected behavior and how to fix it.
The issue is that Visio somehow parses "SomeVariable" different than "SomeVariable*1". I'm not sure if this is a wider spread phenomenon or if it is limited to this one corner case, i.e. the TxtLocPinY cell.
If you don't edit (need to control) the size or location of a shape's text block you are not going to run into this issue.
Title: Re: Can't change shape text size
Post by: wapperdude on July 02, 2020, 09:13:58 PM
@Vojo:  just follow the steps in Reply #14.

@Anyone:
It seems the TxtLocPinY cell is unique... 
  >It seems to only accept the TxtHeight cell as a reference entry.
  >It objects to the lack of a numeric multiplier
  >It objects to using division rather than multiplication to "scale" the entry.

Whereas, the TxtLocPinX does not exhibit such behavior.  It accepts
  >Formulas that use either multiplication or division
  >It accepts references to other shapesheet cells, e.g., Width, as part of the formula.

The TxtLocPinY must be treated with extreme care.  This is either by design (WHY?) or a bug. 

Has anyone tried this out with earlier versions of Visio?
Title: Re: Can't change shape text size
Post by: rezingg on July 02, 2020, 09:20:30 PM
@ wapperdude
I was able to refer to a user cell, as long as it has the format <UserVariable>*<Number>.
Also, a straight number causes the same issue as well.
Title: Re: Can't change shape text size
Post by: Croc on July 02, 2020, 09:33:20 PM
QuoteThis is either by design (WHY?) or a bug.
Perhaps this is not a bug, but simply an under-documented property.
The fact is that when a mouse drags a text block, the formulas in the TxtHeight, TxtWidth cells do not take an absolute value, but are converting to the form Width*a, Height*b. That is, the coordinates of the mouse on the go are converted into a multiplier value. Therefore, to avoid the effect of racing or complex calculations, developers could impose a restriction on the formulas TxtLocPinX, TxtLocPinY, so that they too could have a similar form (namely, TxtWidth*a, TxtHeight*b).
This requirement seems reasonable. The only bad thing is that the developers forgot to tell everyone else about it.
Visio 2007 behaves similarly.
Title: Re: Can't change shape text size
Post by: rezingg on July 02, 2020, 09:50:54 PM
The fact that TxtLocPinX behaves differently seems to point towards BUG rather than FEATURE.
Also, in my limited experience with Visio, I found that an interactive edit of a shape usually replaces whatever content an affected cell has with the default formula with some scale factor. In this case, when the user resizes the text block I would expect Visio to replace the content of TxtLocPinY with TxtHeight*X.
There are some exceptions, such as GUARD() and a class of functions which will not be replaced, but possibly their parameters edited, which is not the case here.
Title: Re: Can't change shape text size
Post by: Machine on July 07, 2020, 04:42:10 AM
Quote from: rezingg on July 02, 2020, 05:23:16 PM
it appears interactive text block resizing only works if the TxtLocPinY cell content has the format <SomeVariable>*<number>. Any other cell content causes issues, including a number by itself or multiplied by another number.

It works exactly as described (in 1907).
Is this an intended behavior?