Shape design / Shape Studio / Shapesheet

D

Daniel Shookowsky

I'd like to create a custom shape and I'm wondering how much I can put
into the shape design vs. custom code. I'm also wondering if I should use
the Shape studio over the ShapeSheet.

I'd like to have a shape with a draggable handle at the center (like the
UML interface). Dragging this handle to another shape should connect the
two shapes (directed graph) with a dynamic connector. Different shapes
should have a limit on the number of outbound connections allowed. I'm
not really familiar with Visio Automation, so I'm wondering how best to
accomplish this.
 
M

Mark Nelson [MS]

You can do quite a bit with the Shapesheet, but there are some things that
are better done through code. Generally, if you want to create shapes or
manage the relationships between shapes, you need code. If you want to
control the behavior of a shape, you need the Shapesheet. Shape Studio is
helpful if you need to make several shapes with similar behavior but is not
worth the overhead / learning curve for just a single shape.

For your scenario I suggest writing code, but you may want to consider
putting the trigger for the code into your shape (i.e. in the Shapesheet).
There is a shape in Visio that does something very similar. Look in File >
Shapes > Visio Extras > Callouts and drag out a Custom callout shape. This
shape has a control handle that you drag out to another shape to display its
custom properties. Look at the Shapesheet of this callout to see how it
works. There are a lot of things going on here, but the basic trigger is in
one User-defined cell:

User.ccAssociate
=DEPENDSON(Controls.Row_1,Controls.Row_1.Y)+RUNADDONWARGS("cc","/cmd=2")

This cell causes the add-on "cc" to run every time the control handle
position changes. Your code could be triggered in a similar fashion. The
code would find out if the control handle is on top of any shape and create
a connection between the shapes if needed. You could also write a value
back into the shape to track the number of connections made. The control
handle could become invisible if you reach the maximum connections allowed.

I would encourage you to download the Visio SDK from
http://msdn.microsoft.com/visio to review actual code samples and snippets
that illustrate how to accomplish each of the programming tasks.
 
D

Daniel Shookowsky

Thanks for the feedback. I do have about 10 shapes that all need to work
in a similar fashion. These already exist in a stencil file. I imagine
that it's still easier to edit these directly rather than go
down the shapestudio road.
 

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