double click behavior

J

John B

I created a new stencil and added a few masters by copying from standard
visio masters. I renamed these and changed the shapes slightly. For one of
these, I defined a function in the stencil and the added
CALLTHIS("ThisDocument.MyFunc1","MyProg") to the shape sheet for this shape.
I saved the stencil, created a template based on the stencil and then created
a drawing based on the template. When I drag the shape to the new drawing
and double click, it calls the function in the stencil document which is the
desired behavior. Everything works. This is great.
Now I opened the stencil, added another function for another shape, edited
the shape sheet to add CALLTHIS etc for Func2, etc. If I double click the
master I am editing, the code works. Now I create a new template, and then a
new drawing. If I drag the first object to the new drawing, it works as
before when double clicked. But when I drag the 2nd object to the drawing(or
drag it first without the first object) double clicking does not work. When
I open the shape sheet, the cell for the formula is empty. Why does this
work when I drag one of the shapes and not for the other? Any ideas?

If anyone from Microsoft is listening, I have been developing for Windows
since version 2.1, c, c++, office vba, vb, atl and I am now looking at .net.
Visio is without any doubt, the worst develpment environment I have ever
worked with. The help system is practically useless and the visio interface
is anything but intuitive. I am stuck with it for the time being but working
with visio been a totally frustrating experience.
 
D

David Parker

Can't completely agree with your comments about the Visio dev environment,
and encourage you to move into .net with Visio. The SDK provides examples
in C# and vb.net.

Regarding VBA, it is usually better to call code behind a stencil, rather
than a drawing, so that it can be called from many drawings and the code is
one place. You say you are calling code in the stencil but you are using
ThisDocument, which will be the current document, not the stencil.
ThisDocument is infact a class, so create a module to put your code in.
 
J

John B

Thanks for the reply. There is some misunderstanding with my reference to
thisdocument. I am in fact calling methods in the stencil but stencils,
templates and drawing all have a thisDocument module which I assume follows
from the fact that visio supports only a single file format; the only
difference between a stencil and a drawing is the .vss extension vs the .vsd
or .vst extensions.

With regard to my original problem, when I would drag shapes to the drawing,
both spapesheets showed the event dblclick formula to have the value
CALLTHIS("thisDocu...) but one would fire and the other one would not. Both
of these would fire if the master shape was opened for editing so I know the
code is correct. In the end, I deleted the shape that didn't work correctly
from the stencil and rebuilt it from scratch. From that I built a new
template and after that it works correctly. So, I have got past the problem
but still have no idea what the problem was.
 

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