Author Topic: Resizing Text boxes automatically when the contents inside change  (Read 41844 times)

0 Members and 1 Guest are viewing this topic.

seberg132363

  • Newbie
  • *
  • Posts: 6
How do I...

I have setup an object with 4 text boxes tiled vertically. The 1st and 4th are pretty static and their vertical size won't change.

The 2nd & 3rd boxes have ODBC connections to an Access DB that returns different lengths of text.

How do I "Automagiclly" make this object resize the text boxes vertically so that the text fits inside, when the text changes.

Thanks...
« Last Edit: June 01, 2009, 03:04:27 PM by Visio Guy »

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: Resizing Text boxes automaticly when the contents inside changes
« Reply #1 on: June 01, 2009, 03:03:47 PM »
Do you want the shape to grow or the text size to shrink?
Visio 2019 Pro

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Resizing Text boxes automatically when the contents inside change
« Reply #2 on: June 01, 2009, 03:07:46 PM »
Hi Seberg,

Try starting here:

Top Twelve Text Tips
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

seberg132363

  • Newbie
  • *
  • Posts: 6
Re: Resizing Text boxes automatically when the contents inside change
« Reply #3 on: June 01, 2009, 06:32:59 PM »
I need the box to grow vertically... font to remain the same...

Will review the link... thanks!!

Nikolay

  • Hero Member
  • *****
  • Posts: 957
    • UnmanagedVisio
Re: Resizing Text boxes automatically when the contents inside change
« Reply #4 on: June 02, 2009, 12:47:54 AM »
Example (fixed width, height is auto-adjusted to text width):


If you need the box to grow only up, then you could e.g. set LocPinY=0

seberg132363

  • Newbie
  • *
  • Posts: 6
Re: Resizing Text boxes automatically when the contents inside change
« Reply #5 on: June 02, 2009, 09:04:05 AM »
Thanks Nikolay! :)

Now they resize beautifully...

Can someone point to some examples of how I go about connecting the four boxes together...

With what I have been reading, I think I need to decide which box will be the parent and then just "Pin" the bottom of that box to the top of the next and so forth...

Learning in leaps and bounds..

Wombat

  • Jr. Member
  • **
  • Posts: 16
Re: Resizing Text boxes automatically when the contents inside change
« Reply #6 on: June 02, 2009, 04:14:13 PM »
You can group four boxes together. The pin for each box then becomes a coordinate inside of the group. The group's height is the sum of all four boxes. It looks like this:

Height = Sheet.1!Height + Sheet.2!Height + Sheet.3!Height + Sheet.4!Height

1,2,3,4 are ids of each shape in the group.

seberg132363

  • Newbie
  • *
  • Posts: 6
Re: Resizing Text boxes automatically when the contents inside change
« Reply #7 on: June 04, 2009, 12:37:52 PM »
Still wokring on my stencil...

and now I'm confused, I just did the formulas for height in the shape transform...

And I am not picking up the general idea on how to join these "Process" boxes together

Process 1
Process 2
Process 3
Process 4

Are stacked verticaly
Boxes 2 & 3 Have Shape Transform Height = TextHeight(TheText,2.5 in) as these boxes are connected to a db and the text contents change.

Can someone point me to an example of how to connect them together so that when boxes 2 & 3 height changes, the 4 boxes stay connected/stacked together and not overlapping...

Thanks in advance..

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: Resizing Text boxes automatically when the contents inside change
« Reply #8 on: June 04, 2009, 01:27:39 PM »
Modify shapesheets for shapes 1, 2, 3.  Shapesheet 3 needs to reference shape 4, modify as follows:

Shape Transform section:
PinY = Sheet.4!Height
LocPinY = Height*0

Where "Sheet.4" is the shape ID for text box 4. 

You need to do similarly for shapes 1 and 2.  Only shape 1 references shape 2, and shape 2 references shape 3.

Basically, you're making the each shape reference the shape underneath it.  That way, as a lower shape grows, all shape above it will track the growth.


HTH
Wapperdude
Visio 2019 Pro

seberg132363

  • Newbie
  • *
  • Posts: 6
Re: Resizing Text boxes automatically when the contents inside change
« Reply #9 on: June 05, 2009, 10:44:05 AM »
Thank you Mr WrapperDude!!

I now have a functioning template inside of the Stencil...

This being my 2nd template and to-date the most complex, my last question (hopefully) is:

 How do I get the formulas to stay when I drag the new stencil to the a new document?

 After adding the template to a new document, I look at the Shapesheet, and all of the formulas are gone...

 What am I missing? I R Nuwb...

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: Resizing Text boxes automatically when the contents inside change
« Reply #10 on: June 05, 2009, 10:50:20 AM »
Doh!  My bad.  ::)  :P

For ALL of the entries that you've modified in the Shape Transform section, you should put the "guard" function around them, e.g.,

PinY = guard(Sheet.4!height).
LocPinY = guard(Height*0)

Wapperdude
Visio 2019 Pro

seberg132363

  • Newbie
  • *
  • Posts: 6
Re: Resizing Text boxes automatically when the contents inside change
« Reply #11 on: March 29, 2010, 05:39:54 PM »
Hello, I am back...

I am trying to fix an anomaly of my master, the automated shape is working almost as required except for the following...

The 4 boxes, are stacked vertically. The Second and third box resize when the text inside is changed.

Issue: After making the edits to the 2nd and 3rd boxes the outline (shapesheet shows the following in the title bar:

"Stencil:MasterName:Sheet.x <Shape>"

The outline does not match the new outline of the 4 boxes.

Just to reiterate, outline is what I call what shows selected when you click on the master the 1st time, I then click again on one of the 4 boxes to make changes to the boxes... and I cant reference the boxes parameter (height).

Thanks in advance,

S

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: Resizing Text boxes automatically when the contents inside change
« Reply #12 on: March 29, 2010, 08:21:38 PM »
By chance, did you ungroup before doing your edits?  If you did, and then regroup, that might (will) change the group ID.

Wapperdude
Visio 2019 Pro