Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: seberg132363 on June 01, 2009, 05:48:17 PM

Title: Resizing Text boxes automatically when the contents inside change
Post by: seberg132363 on June 01, 2009, 05:48:17 PM
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...
Title: Re: Resizing Text boxes automaticly when the contents inside changes
Post by: wapperdude on June 01, 2009, 08:03:47 PM
Do you want the shape to grow or the text size to shrink?
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: Visio Guy on June 01, 2009, 08:07:46 PM
Hi Seberg,

Try starting here:

Top Twelve Text Tips (http://www.visguy.com/2009/05/06/top-twelve-text-tips/)
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: seberg132363 on June 01, 2009, 11:32:59 PM
I need the box to grow vertically... font to remain the same...

Will review the link... thanks!!
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: Nikolay on June 02, 2009, 05:47:54 AM
Example (fixed width, height is auto-adjusted to text width):
(http://nbelyh.googlepages.com/fixed-width.png)

If you need the box to grow only up, then you could e.g. set LocPinY=0
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: seberg132363 on June 02, 2009, 02:04:05 PM
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..
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: Wombat on June 02, 2009, 09: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.
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: seberg132363 on June 04, 2009, 05: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..
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: wapperdude on June 04, 2009, 06: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
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: seberg132363 on June 05, 2009, 03:44:05 PM
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...
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: wapperdude on June 05, 2009, 03:50:20 PM
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
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: seberg132363 on March 29, 2010, 10: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
Title: Re: Resizing Text boxes automatically when the contents inside change
Post by: wapperdude on March 30, 2010, 01:21:38 AM
By chance, did you ungroup before doing your edits?  If you did, and then regroup, that might (will) change the group ID.

Wapperdude