Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: 2020Visio! on August 24, 2015, 02:13:38 PM

Title: Shape behavior: as you type more text, shape expands downwards
Post by: 2020Visio! on August 24, 2015, 02:13:38 PM
Wow the shapesheet looks impressively complex for someone new to it! :)

Please see the concept shape diagram with explanation attached.

I am looking to create shapes that expand downwards (in height) as you type more text into the text box. They are top aligned and there is only one connection point on the shape (the connections are also top aligned).

What is the best way to achieve such shape behavior for the amount of text in the text box?

Also, the whole shape inheritance thing in Visio is pretty dizzying for newbies. Is there a really good explanation somewhere that will help bring clarity to this?

Thank you so much!

Jim
Title: Re: Shape behavior: as you type more text, shape expands downwards
Post by: wapperdude on August 24, 2015, 07:15:06 PM
To get the text behavior, format > Text > TextBlock > Alignment = Top.  No need to edit shapesheet...yet.

To get the shape to grow with the text, now, open the shapesheet. 

In the Shape Transform section, edit the entry for height:
Simple formula:  =guard(TEXTHEIGHT(TheText,Width))

This locks the height to the text. 

Better formula:
=MAX(SETATREFEXPR(1 in),TEXTHEIGHT(TheText,Width))..  Note, the value, 1 in, is just a placeholder so that the initial height is not zero. 

This allows the shape to be enlarged manually.  It will allow the size to be either the height needed for the text, or some manually set value, whichever is larger

For good, basic background on Visio, check out the following:
   All about Visio:  https://msdn.microsoft.com/en-us/library/aa245244(v=office.10).aspx
   shapesheet reference:  https://msdn.microsoft.com/en-us/library/ms427031.aspx

Wapperdude   
Title: Re: Shape behavior: as you type more text, shape expands downwards
Post by: 2020Visio! on August 24, 2015, 09:06:30 PM
Super we'll apply these formulas to the shapes, actually pretty straightforward now that I see it but hard to figure out when you're new to Visio. So thank you very much for pointing the way!

The whole shape inheritance model in Visio is still pretty unclear at this point, is there an article somewhere that clarifies this?

Jim
Title: Re: Shape behavior: as you type more text, shape expands downwards
Post by: wapperdude on August 24, 2015, 09:44:46 PM
Not sure what you have in mind re "inheritance".  Take some time to look thru the above referenced links.  In addition to those, this may be helpful.

Shapesheet formula syntax:  https://msdn.microsoft.com/en-us/library/aa200961(office.10).aspx.

VisioGuys blog site has a lot of useful information:  many topics with examples, links, books.

Pretty much it's looking at examples.  Download the SDK, it's free.  Many code examples.  Use the macro recorder. 

Some things to be aware of:
  1)  Any shapesheet cell that is exposed to values input via GUI or manual manipulation will get clobbered, unless guard fcn or perhaps setatref() fcns are used.  Even these can get clobbered by the setf() fcn.

  2)  Shapes with built-in features that use behind the scenes coding, e.g., timeline stuff, are difficult to customize.

HTH
Wapperdude