How to cause a shape to automatically position itself when dropped

N

Nebulous

I have seen shapes that automatically position themselves on drop from the
stencil, such as left-aligning themselves to the left margin, or aligning
themselves to a nearby shape. I've been trying to recreate that effect with a
custom shape but have been unable to do so. I am NOT a developer, I'm just a
novice tinkerer (and not yet a very good one in Visio).

To be specific, I create business processes using HORIZONTAL pools and
swimlanes, the swimlane being a rectangle that overlays, or visually sits
"inside" a pool, which is a larger rectangle.

I want to accomplish two things:
(1) When I drop a pool shape I want it to automatically align with the left
page margin and stretch the whole way to right page margin
(2) When I drop a swimlane shape on top of (or "inside") a pool, I want it
to left align with the pool's text box and stretch to the right edge of the
pool (i.e., so that the length of the swimlane is the same as the length of
the pool minus the width of the pool's textbox).

Please excuse the following ASCII art if it confuses things :)
POOL
--------------------------------------------------------------------------|
| * |-------------------------------------------------------------------- |
| * || * |
|
| * || * | SWIMLANE
|
| * || * |
|
| * |-------------------------------------------------------------------- |
---------------------------------------------------------------------------|

I figured the way to accomplish this is to use an Event Formula in the
EventDrop cell in the "Events" section of the Shape Sheet. (Whew!)

But I don't see a way to do this. Can you help?

Thanks in advance!

Nebulous
 
P

Paul Herber

I have seen shapes that automatically position themselves on drop from the
stencil, such as left-aligning themselves to the left margin, or aligning
themselves to a nearby shape. I've been trying to recreate that effect with a
custom shape but have been unable to do so. I am NOT a developer, I'm just a
novice tinkerer (and not yet a very good one in Visio).

To be specific, I create business processes using HORIZONTAL pools and
swimlanes, the swimlane being a rectangle that overlays, or visually sits
"inside" a pool, which is a larger rectangle.

I want to accomplish two things:
(1) When I drop a pool shape I want it to automatically align with the left
page margin and stretch the whole way to right page margin
(2) When I drop a swimlane shape on top of (or "inside") a pool, I want it
to left align with the pool's text box and stretch to the right edge of the
pool (i.e., so that the length of the swimlane is the same as the length of
the pool minus the width of the pool's textbox).

Please excuse the following ASCII art if it confuses things :)
POOL
--------------------------------------------------------------------------|
| * |-------------------------------------------------------------------- |
| * || * |
|
| * || * | SWIMLANE
|
| * || * |
|
| * |-------------------------------------------------------------------- |
---------------------------------------------------------------------------|

I figured the way to accomplish this is to use an Event Formula in the
EventDrop cell in the "Events" section of the Shape Sheet. (Whew!)

But I don't see a way to do this. Can you help?



To get you started, set the shape's
PinX = Guard(0mm)
Width = ThePage!PageWidth
Once you got that working you can also add (or subtract!!!!)
references to the left and right margins.
 
N

Nebulous

Paul:

You definitely pointed me in the right direction, and I have a partial
solution. Thank you!
The problem with the "Pool" shape is solved, so that it automatically
resizes to fit inside the margins and centers itself on the page. For that I
used the following:

Width=ThePage!PageWidth-PageLeftMargin-PageRightMargin
EventDrop=SETF("PinX",PageLeftMargin)

How do I acheive what I need to with the "Swimlane" shape? I need to be able
to drop it on top of the Pool Shape and have it automatically resize to the
same as the Pool shape minus the width of the pool shape's text block and
then position itself left-aligned with the Pool's text block.

For example, if for POOL:
Width=16.5in
TxtWidth=0.5in
PinX=0.25in

Then I need my Swimlane to automatically become:
Width=16in
PinX=.75

So that it is left-aligned against the right edge of the pool's text block.

I need to clarify that the text block for the Pool shape uses vertical text,
is .5" wide (but can grow if there are multiple lines of text), and begins at
the left edge of the Pool Shape, so it looks like this:

----------------------------------------------------------
| T |
| E |
| X | POOL
| T |
----------------------------------------------------------

Am I being clear enough?

Thanks,

jb
 
M

Mark Nelson [MS]

It is very difficult to make one shape depend on the properties of another
using just the Shapesheet. Typically you need code to set up the
relationship between the shapes, and then the Shapesheet can handle the
rest.

A nifty alternative is to have one shape store information about itself on
the page's Shapesheet (aka PageSheet). Then other shapes can reference that
information without needing to know about the original shape. There is a
series of articles that explains how this technique can be used to make
diagrams where shapes automatically position themselves. I think you could
adapt it to pools and swimlanes.
http://blogs.msdn.com/visio/archive/2007/02/06/introducing-the-bubble-chart.aspx
http://blogs.msdn.com/visio/archive/2007/02/09/make-your-own-bubble-chart-part-1.aspx
http://blogs.msdn.com/visio/archive/2007/02/13/make-your-own-bubble-chart-part-2.aspx
http://blogs.msdn.com/visio/archive/2007/02/16/make-your-own-bubble-chart-part-3.aspx

Finally, I just want to make sure you are aware that Visio ships with a
Cross-Functional Flowchart diagram that provides pool and swimlane
functionality for you.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
N

Nebulous

Mark:

Thanks much for this reply.

I am creating my own stencil for BMPN as we use it in our company a nd am
trying to add some conveniences to the shapes. That's the reason I'm trying
to do this automation -- that, and learning a little as I go.

I did look at the "functional band" shape in the Cross-Functional Flowchart
stancil, and it really does almost exactly what I want. I checked out its
ShapeSheet and found the following for EventDrop:

RUNADDON("CFF")

Can you tell me what "CFF" is? I don't see an Addon that is called that or
that could be abbreviated that way. I guess I'm wondering whether I can make
my own Swimlane behave the same way as "Functional Band" shape by reproducing
its Shape Sheet properties.

I haven't read the blog posts you pointed me to yet, but I will do that
next. Just wanted to get this question out there for you.

Thanks again,

Nebulous
 
P

Paul Herber

Mark:

Thanks much for this reply.

I am creating my own stencil for BMPN as we use it in our company a nd am
trying to add some conveniences to the shapes. That's the reason I'm trying
to do this automation -- that, and learning a little as I go.

I did look at the "functional band" shape in the Cross-Functional Flowchart
stancil, and it really does almost exactly what I want. I checked out its
ShapeSheet and found the following for EventDrop:

RUNADDON("CFF")

Can you tell me what "CFF" is? I don't see an Addon that is called that or
that could be abbreviated that way.

That's the Cross Functional Flowchart
It isn't shown in the normal list of add-ons called XFUNC.DLL
 
N

Nebulous

<blush> How I didn't realize "CFF" stood for "Cross Functional Flowchart"
after I had just typed those words is beyond me. :)

Thanks for the clarification. I tried reproducing that shape and then
removing the Event Drop and it didn't affect the resizing and repositioning
(I wrongly assumed that is where it was controlled).
 
M

Mark Nelson [MS]

I'm not sure exactly what you tried with the custom shape. Visio triggers
the EventDrop cell of a shape whenever a new instance is dropped on the
page. The Functional Band shape has a RunAddon call that invokes the
Cross-Functional Flowchart add-on. The add-on is responsible for keeping
things sized and arranged properly.

There are some hidden shapes in the Cross-Functional Flowchart stencil that
may be needed to make Functional Bands work properly. Try starting a new
CFF diagram and adding one functional band to the page. Go to View >
Drawing Explorer to see the shapes that make up the CFF diagram.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top