Problem with Event Handling in Visio 2003

C

Chris

Hi,

I am currently working on a VB.NET 2005 app which contains an event handler
for Visio to capture shape-added events. When a shape is added to a Visio
drawing, the event handler opens up a dialog box. Problem is, if the dialog
box is open for a minute or more then the remaining code in the event handler
after showing the dialog box is not run.

It is almost as if the event handler time's out or loses connection to Visio.

Strangely this works fine with Visio 2002 but not Visio 2003.

I saw somewhere that Visio 2003 has a lot more events, especially for mouse
movement. Could this be causing the problem?

Any ideas on this would be greatly appreciated.

Thanks,

Chris
 
C

Chris [Visio MVP]

Sometimes I build up a collection of ThingsToProcess, then wait until the
visio app event VisNoEventsPending, or VisIdle fire. At this point, Visio is
done doing anything important, and it's a better time to run your code.

SO, my ShapeAdded event (or SelectionAdded) would add a shape or shapes to
the ThingsToProcess collection. Then, when Visio fires the
VisNoEventsPending event, I'd clean up the collection and show dialogs or do
whatever to the shapes in that collection.
 
C

Chris

Hi Chris,

thanks for your quick response.

I still think it is odd that Visio 2002 has no problem with it. However, I
will see what I can do and let you know if this resolves the problem.

Thanks,

Chris
 
C

Chris

This works great now. Basically I stored a copy of the shape being added and
only when receiving the VisIdle event do I open the dialog form and process
the results.

Many thanks for you help on this matter!

Chris
 

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