Development

Tips & code for programming Visio & using the ShapeSheet

Maps & Geography

Maps & geography shapes & templates galore!

Network

Shapes & tools for Visio network diagrams.

News

Find out what’s new in the Visio world!

Shapes

Download useful & attractive Visio shapes. For free!

where can i buy windows 7 cheapest buy windows 7 upgrade from xp windows vista purchase price buy inventor 2010 pctools spyware doctor 5.5 buy windows 7 best price norton ghost 12 product key windows 7 price future shop windows xp price singapore windows 2008 web server download omnipage coupon buy windows 7 starter download adobe indesign cs3 for mac buy vista to windows 7 microsoft project 2003 download buy windows xp operating system windows 7 home premium cheap mathcad pricing photoshop buy mac discount autocad 2009 purchase microsoft money 2007 deluxe download photoshop mac autodesk maya 2009 price windows vista business download windows 7 price 64 bit purchase windows 7 ultimate full version buy windows 7 home premium key lightroom for apple purchase windows xp india adobe cs4 photoshop buy where to buy encarta 2009 purchase vista oem buy windows 7 tesco cheap adobe fireworks windows 7 price online best price corel draw 11 mac discount powerpoint buy microsoft office for mac canada buy microsoft project 2002 adobe production premium mac turbotax 2009 deluxe best price windows 7 ultimate 64 bit best price buy windows 7 amazon adobe flash pricing adobe dreamweaver sale purchase windows 7 ultimate buy quickbooks pro 2007 roxio copy & convert 3 buy download photoshop elements 6 steinberg nuendo price uniblue registrybooster 2009 download cheap photoshop programs adobe photoshop elements cheapest buy windows 7 future shop adobe presenter 7 download microsoft office 2003 sale buy quarkxpress 8 for mac purchase adobe cs3 design premium purchase after effects cs3 paperport professional 12 prices cakewalk download parallels desktop price buy microsoft windows 7 home premium cheap adobe after effects for mac how to purchase windows 7 online download microsoft streets and trips 2008 microsoft office 2003 cheapest buy windows 7 online singapore purchase autodesk 3ds max 2009 buy windows xp pro best price adobe flash cs3 buy uniblue registrybooster 2009 cheap windows 7 ultimate retail buy autodesk autocad buy microsoft office document imaging purchase microsoft office 2003 buy windows xp media centre edition discount microsoft windows 7 ultimate windows 7 price upgrade cheap adobe photoshop software burnaware professional price buy acronis true image 2010 windows 7 price change buy acrobat 7 where to buy adobe flash cs3 quicken 2010 price buy windows xp corporate buy office 2007 student product key windows 7 price hong kong buy windows 7 64 buy acrobat professional 9 symantec winfax pro 10.4 buy cheap windows 7 keys adobe photoshop cs4 buy buy microsoft visio 2007 turbotax deluxe 2009 download windows xp price in rupees buy lightroom software buy windows 7 buy windows 7 serial key steinberg nuendo 3 download download autodesk 3ds max 9 buy ms project online windows 7 price egypt windows 2008 enterprise download parallels mac download adobe lightroom sale cheap cubase 5 where to buy windows xp service pack 2 purchase windows vista download cheap windows 7 in singapore lowest price microsoft office purchase windows 7 license key where can i buy windows 7 starter edition buy i.r.i.s. readiris pro 11 cheap windows xp operating system buy office 2003 key where to buy windows xp cheap autocad mechanical 2009 download buy matlab software buy 3ds max 2010 student download dragon naturally speaking autocad inventor download get autocad 2010 buy adobe illustrator cs2 buy windows 7 mac windows xp price canada steinberg cubase sx3 download cheap windows 2003 enterprise download adobe illustrator cs3 can i buy windows xp online windows xp price in malaysia buy adobe cs4 suite best price adobe illustrator cs3 download font folio 11 acdsee pro license key cs3 production premium mac ms streets and trips 2008 download download adobe illustrator mac windows 7 price in india where can i buy cubase sx3 windows vista download iso roxio creator 2010 coupon code microsoft office price student windows 7 home premium 64 bit oem buy microsoft frontpage software buy windows xp 64 pro cheap windows 7 home premium full version buy burnaware professional cheap microsoft works 9 microsoft visio download adobe cs4 web premium oem download disk director cheap adobe creative suite cs4 microsoft money home and business download buy parallels desktop 5 for mac cheapest norton 360 3.0 lightroom price buy windows vista pro microsoft money buy online buy microsoft expression blend 3 buy windows 7 full version for students purchase lightroom 2 buy microsoft office ultimate pdf converter professional 6 promotional code buy adobe cs3 design premium buy indesign cs3 software buy windows vista ultimate upgrade acdsee photo editor download microsoft office 2003 professional cheap windows 7 for college students illustrator cs3 download download adobe indesign cs4 cyberlink powerdirector prices buy windows vista ultimate license buy access 2003 online windows 7 price guide mathcad price buy after effects cs4 mac cheap fl studio 8 xxl cheap photoshop elements 8 buy windows vista home premium oem buy wordperfect x3 buy windows 7 home premium 64 bit buy windows 7 brisbane buy windows 7 bangkok autodesk mudbox price purchase vista license cheap adobe premiere elements 8 download adobe creative suite 4 design premium best price microsoft excel 2003 buy microsoft project 2000 microsoft expression price discount photoshop elements 8 cheap maya software 3ds max sale buy windows 7 ebay windows 7 price 2010 deskshare videoeditmagic 4.3 price buy windows xp 2010 norton 360 price comparison buy windows xp used adobe contribute mac purchase windows 7 for mac buy windows vista home premium product key buy windows 2003 datacenter buy windows 7 professional cheap microsoft windows 7 ultimate buy sony vegas pro 8 purchase access 2007 final cut express 4 cost download microsoft visio 2007 buy onenote 2003 photoshop lightroom for mac symantec pcanywhere download windows 7 price pakistan buy premiere pro cs3 cheap windows 7 for students in australia web page maker 3 download buy windows xp home sp3 adobe photoshop best buy cheap windows 2008 enterprise buy windows 7 direct download download microsoft mappoint 2009 buy windows xp home download microsoft autoroute 2007 europe ashampoo burning studio download buy windows xp calgary archicad 13 download adobe cs4 design premium trial price photoshop elements 8 windows 7 home premium cheapest autodesk lustre pricing purchase archicad 13 acdsee pro 2 download windows 7 discount canada vmware workstation 7 download discount autodesk 3ds max 2009 buy autodesk inventor professional buy windows xp home full version buy windows 7 language pack buy microsoft office 07 buy microsoft excel 2007 download propellerhead reason 4 mappoint 2009 european buy access 2007 only buy frontpage 2003 purchase windows 7 ultimate online purchase microsoft windows vista buy dragon naturally speaking 10 oil price vista gadget pinnacle studio 14 best price cheap corel video studio pro x2 buy photoshop 7 for mac buy adobe cs3 design premium mac download ashampoo burning studio 9 cheap microsoft project 2007 dvd ripper platinum 5 buy adobe premiere pro cs4 download best price microsoft windows vista windows 7 discount for high school students purchase windows 7 professional (64 bit) compare price photoshop buy windows 7 philippines buy microsoft office powerpoint 2007 purchase windows xp sp3 buy photoshop elements 8 mcafee total protection 2009 download best buy autocad 2009 buy windows vista singapore purchase windows 7 now buy windows xp mumbai buy windows 7 ultimate 64 bit oem windows 7 price kenya ms works download adobe acrobat 9 oem buy windows 7 downloadable adobe cs4 web premium trial cheap windows 7 professional best price windows 7 home premium oem download adobe photoshop elements 6 navisworks manage price windows 7 price comparison buy guitar pro 5.2 download acronis true image 11 buy nero 8 ultra edition acdsee price download adobe robohelp 8 buy powerdirector 7 ultra imsi turbofloorplan home and landscape pro 12 buy buy microsoft expression studio 2 windows 7 discount for military buy windows 7 30 download pinnacle studio 12 ultimate adobe acrobat price comparison mappoint 2009 europe buy cheap avanquest mylogomaker professional 2 buy windows xp cheap microsoft office discount code buy windows 7 switzerland buy windows xp volume license buy norton 360 download cheap adobe photoshop cs3 download microsoft expression studio 3 buy office 2010 professional fl studio 8 xxl download buy microsoft office 2007 home and student cheap adobe cs4 design premium abbyy finereader 9.0 express edition where to buy streets and trips 2010 office 2007 price student buy roxio creator 2010 cheap adobe cs4 master collection mac buy windows xp ebay cheap indesign software buy corel photoimpact x3 download avanquest mylogomaker professional 2 cheap ashampoo burning studio 8 adobe captivate pricing autocad architecture oem buy microsoft office pro 2007 where can i buy powerpoint 2003 turbo tax cost buy windows 7 india online purchase windows 7 license online buy adobe flash cs4 buy windows vista ultimate product key buy cs4 mac buy adobe indesign cs4 best buy microsoft windows 7 ultimate cheap adobe dreamweaver cs4 mac cheap windows 7 canada roxio creator 2009 special edition microsoft office 2010 price in india windows 7 price canadian buy windows xp embedded download corel draw 12 adobe creative suite 4 production premium download buy adobe photoshop cs3 extended buy windows vista business 64 bit buy ms office 2003 pro best buy quicken 2010 buy microsoft office for mac cheap buy adobe after effects cs4 cheap norton 360 3.0 best price adobe cs4 master collection windows 7 price for teachers buy windows xp student purchase adobe acrobat 8 professional buy sql server guitar pro 5 mac download
Home » Development, ShapeSheet

Title Block #3: Smart Tabs, Smart Text

Submitted by Visio Guy on January 23, 2009 – 2:15 pm | | 5830 views 4 Comments

title-block-3

Today we’ll continue our discussion of title block topics by talking about how to control the location of text chunks in a shape’s text block.

Sure, Visio text has tabs, which we’ll put to use. But in the wrong hands and on the wrong shapes, tabs can blow up in your face!

But never fear, for today we introduce the concept of Smart Tabs. Smart tabs are tabs that organize your text properly, even when your shape changes size!

Creating a Basic Field-name/Field-value Text Block

Before we get too far down the line, we’ll want to create a basic text block shape that contains two items: a field-name and a field-value. Ultimately, these fields will be linked to data, but for now, they can just be typed-in text, separated by a tab. The goal will be to end up with two styles of  blocks, which look something like this:

field-name-field-value-02

Visio Guy Title Block Series

If you’ve read our first two articles on creating and customizing Visio title blocks, then you’ve learned a lot about what can be done as far as linking shape text to shape data. If you haven’t seen the articles, you can check them out here:

We won’t go into the details of linking text to data in this article, since you’ve got these other articles at your disposal.

Visio Doesn’t Do Tables

Visio shapes can not only contain data  in Shape Data fields, but they can also link that data to text that is displayed on the shape itself.

But often times we want to show more than one field, and give descriptors to each field to boot. As soon as we have multiple fields, we also want to control how they are positioned and organized on the shape–preferably in neat rows and columns.

In a web-page or Word document, you’d simply insert a table. But Visio doesn’t support tables in shape text blocks.

You could use multiple shapes to form rows and columns, but this gets inefficient, and the linking of Shape Data fields to so many separate shapes can be tricky, confusing and lots of work!

Basic Tabbery: Setting Up Our Shapes

So let’s get to illustrating the problems and solutions, since we are Visual People!

Below, we see two shapes that both contain a field-name and a field-value. These text items could be linked to real data stored in the shape’s Shape Data fields. They are both efficiently constructed, having two bits of data are stored in a single shape.

There is a tab between the field-name and the field-value, but the tab-locations still leave something to be desired:

field-name-field-value-01

Note: The second shape is a single shape, not two rectangles. It was created by drawing a rectangle, then drawing a vertical line 1/3 along the way from the left, selecting both shapes at once, and finally choosing: Shape > Operations > Combine from the menu.

And if you’re wondering about inserting linked fields, we’ve talked that before in the article: Title Blocks #1: How to Display Existing Document Information

Now, we’d like to configure the tab stops so that our text is aligned more like this:

field-name-field-value-02

Visio’s Text Ruler

We can accomplish this by using Visio’s Text Ruler, which is similar to that found in Microsoft Word. Since each shape has a slightly different tab setup, let’s look individually at how each one was configured.

In the first shape, the tab is set to right-aligned, and located such that the field-value appears at the end of the shape. The field-name is at left and doesn’t require any fancy configuration, other than that the entire shape is set to left-aligned paragraph text.

field-name-field-value-03

Note: If you don’t see the nifty text ruler while you’re editing a Visio shape’s text, just right-click and check  Text Ruler (while you’re in text-edit mode!)

In the second shape, the tab is left-aligned, and located roughly 1/3 of the way along the shape:

field-name-field-value-04

That wasn’t so hard. And the shapes look much better already!

Both of these  shapes are now good candidates to be parts of a title block, whose data fields get populated in any number of ways. A user might manually enter values in the Shape Data window for the title block shape, or an automated solution might programmatically set the data when, say, a new project gets created.

Tabnation! What Happens When the Shape Changes Size?

Now we’ve got two fine-looking shapes. Both with two fields and one tab stop. These shapes are likely to be parts of title blocks on the drawing, and are likely to change size depending on the paper size, the available space on the drawing, or the whims of the user.

What Bad Tabs Look Like

The big problem arises when we resize the shapes:

field-name-field-value-05

What a mess! In some instance the field-values have just stayed put, ignoring the size of the shape. In other instances, they’ve jumped around randomly.

You can see that the first shape’s field-value does not stay aligned to the right side of the shape, and the second shape’s field-value doesn’t match up with the vertical line.

Something’s got to be done!

What Good Tabs Look Like

What we’d really like to see is this:

field-name-field-value-06

That definitely looks much better! And Smart Tabs are the way to get this to happen!

How to Create Smart Tabs

In order to create the smart tabs, we start with the shapes that we’ve already created– inserting tabs and specifying their alignment. Nothing special about that.

Once that’s set up, we then must venture into the ShapeSheet and smarten-up the tab-stop positions by using ShapeSheet formulas.

The Tab Section of the ShapeSheet

If you select a shape such as one of the two blocks we’ve been talking about, then choose: Window > Show ShapeSheet from the menu, you’ll be presented with a big, scary Excel-spreadsheet-looking interface.

About half-way down, you should find a section called Tabs. If you don’t see this section, go to View > Sections and click Tabs near the bottom of the middle column of check boxes.

The first column in this section is called Position, and it is the position cells that we are interested in. As they stand now, the position cells will contain fixed values. We want to change that by creating smart formulas that make these positions dynamic.

Smart Tab ShapeSheet Formulas

So for a tab like the top shape’s, where the field value text should stay aligned at the right end of the shape, we enter a formula like this:

Tabs.Position = GUARD( Width – LeftMargin – RightMargin )

GUARD protects the expression from being overwritten, especially when the shape is duplicated.

Since the text should be all the way to the right of the shape, we set the position to Width, which is the length of the shape. But the text block is slightly less than the width of the shape, due to margins, so we subract off LeftMargin and RightMargin to get things just right.

If you peruse the ShapeSheet some more, you’ll find that Width, LeftMargin and RightMargin are all cells in the ShapeSheet. Just as in Excel, you could have built the formula by clicking on those cells while entering the expression.

For the bottom shape, the formula is a bit simpler. We want the tab to be at 1/3 of the width of the shape, so we enter:

Tabs.Position = GUARD( Width/3 – LeftMargin )

In this case, only the LeftMargin figures in to the correction, since we are only locating the tab relative to the left side of the shape.

Additional Features

With smart tabs, your shape’s text is well behaved.

And without building-in any more smarts, your shapes are more capable than you think!

Multiple Lines of Text

Since tabs apply to columns, you can enter several sets of data–each on a new line– and they will all look wonderful, no matter how you size the shapes! Just have a look:

field-name-field-value-07

You’ll note that the “1/3″ shape is a bit restricted, because, in this example, the field names are comparable in length to the field values. So the 1/3 location doesn’t make a lot of sense, and wastes a lot of space.

Control Handles and Multiple Tabs

Since the “1/3″ shape potentially wastes all that space, we can parameterize the location of the divider-line, and thus the location of the tab. What follows is a brief description of how we could improve the second shape even more. I won’t go into gory details and tons more pages. But I’ll point you in the right direction and hit the major points of what needs to be done.

Adding a control handle to the shape offers the user a great way to graphically alter the position of the divider. Below, you see the yellow diamond that represents the control handle:

field-name-field-value-08

Users can simply tug on the control handle to move the line and the corresponding tab stops, but only after we link tabs and geometry to the control handle.

We inserted this control handle using the ShapeSheet’s Insert > Section command. We then gave the new Controls row the name of dividerPosition. The row name is the red text on the very far left of a row. You type in “dividerPosition”, then hit enter. You’ll then see “Controls.dividerPosition” when you’re done. But you don’t need to type in “Controls”.

We then referenced the position of the control handle in the geometry of the vertical line:

Geometry1.X1 = Controls.dividerPosition

Geometry1.X2 = Controls.dividerPosition

You’ll also notice that the field name is now right-aligned at the dividing line. In order to do this, we had to enter a tab before the text. And correspondingly, we had to define a new tab location. So now we have two tabs: one just to the left of the line, and one just to the right of the line:

field-name-field-value-09

Two tab locations now require two smart tab formulas, and they look like this:

Tabs.Position 1 = GUARD( Controls.dividerPostiion - Char.Size/2 – LeftMargin )

Tabs.Position 2 = GUARD( Controls.dividerPostiion + Char.Size/2 – LeftMargin )

Most of this should look familiar, except that now we are adding and subtracting Char.Size/2.

Char.Size is just the font size for the text. You’ll find the Char.Size cell in the Character section of the ShapeSheet. I’ve used it in our smart tabs so that the text isn’t jammed up against the line, but instead leaves a bit of space.

We could have subtracted and added a fixed value, like +/- 2pt, but I figured it would look better if the spacing grew and shrunk proportionally to the size of the font.

Title Block Series

Follow the series on Title Blocks as it develops, past present and future:

Related Posts

  1. Title Block #2: Let’s Make a Multi-field SmartShape!
  2. Title Blocks #1: How to Display Existing Document Information
  3. Run Circles Around Your Text With the Circle-text Title SmartShape
  4. Text to the Bottom of the Shape
  5. Text Resizing with ShapeSheet Formulas

4 Comments »

  • Rob Stone says:

    How do you join mutable of these smart blocks together and have them still ask you to fill in the information when you select it to ask for the info on insert. So far the only way I have been able to do this is to create it in AutoCAD and import it and then have Visio convert it, and then modify the shape sheet. (Creating Title blocks)

  • Visio Guy says:

    Hi Rob,

    So you want to make one big title block with lots of different fields, it sounds like.

    Unfortunately it isn’t super-easy, but here’s a rough outline of what to do:

    1. Arrange a bunch of title blocks as desired
    2. Group them together
    3. Add Shape Data fields to the group for each title block sub-shape
    4. Set these data fields to “ask on drop”
    5. Insert text fields for each sub-shape/title-block element

    When you drop or copy the grouped shape, Visio will prompt you to fill in the Shape Data fields.

    Step #5 is perhaps the most complicated part, which I need to address with an article one of these days.

  • Dominic Rager says:

    I have created a new title block stencil to use for engineering drawings for work. It has a border that is about 3/8″ from each edge of the paper and a title block that shows our company name, title of drawing, date, scale etc. I typically print my drawings on 8.5″x11″ paper.

    Occasionally I need to change the drawing scale so that whatever I’m working on fits on the paper size I am using. When I change the drawing scale say from 3/8″ = 1′ to 1/4″ = 1′, the title block “border” stays the same but the title block itself adjusts with the drawing scale. I have to ungroup my title block stencil, manually resize the “title block” portion and then regroup.

    How can I set the title block so that it “acts” the same as the border when I change the drawing scale?

    Thank you,

  • Visio Guy says:

    Hi Dominic,

    This is a good question, and the answer isn’t super-simple, but perhaps I’ll give you a few clues and hopefully not sound too obscure.

    The idea with title blocks and borders is that they are not part of the scaled world. I usually put them on a background page that is not scaled, for simplicity.

    If you have a title block on a scaled page, though, then the concept is that the title block should be, say 3in x 5in in PRINTED size, no matter the scale of the drawing. You are seeing this happen with the border you are using.

    So let’s say we want our title block to print out at 3 x 5, regardless of scale. We can make this happen by using the ShapeSheet and entering the formulas for Width and Height as so:

    Width = GUARD( ThePage!DrawingScale/ThePage!PageScale * 5in )
    Height = GUARD( ThePage!DrawingScale/ThePage!PageScale * 3in )

    This causes your title block to get bigger or shrink in response to scale changes (ie: it needs to be 50 ft long to print at 5in in a 1:10 scale, etc.)

    The GUARD will prevent you from manually resizing the shape, so the “3 x 5″ should be changed to match the real size of your title block.

    To control location, you can use this anti-scaling formula for PinX and PinY as well.

    I usually create a user-defined cell to hold this expression so that I can re-use it:

    User.AntiScale = ThePage!DrawingScale/ThePage!PageScale

    and then we simplify our other expressions to:

    Width = GUARD( User.AntiScale * 5in )
    Height = GUARD( User.AntiScale * 3in )

    Hope this sheds a bit of light on the mystery!

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.