Stop events from firing?

Started by michelleh, January 21, 2011, 05:01:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

michelleh

Hi experts!  I have a .Net addon that generates a drawing with many complex shapes.  After the drawing is displayed and my code is done, Visio 2010 is still busy for several more seconds.  I investigated and found that Visio is sending FormulaChanged and CellChanged events during this time.  I uninstalled all other addons and removed watching these events from my addon, and the lag is still there.  Is there any way to stop this from happening?

Thanks!

aledlund

Those events are how visio manages the drawing/shapesheets. I'd investigate whether they are being trapped in your event handler and make sure I exit the handler when one fires.
al

michelleh

Thanks, but my code is not registered for those events, so is not handling them.  I don't think that any addon is.  The drawing is based on my own custom template, so there aren't any in-the-box Visio solutions running (e.g. org chart) that could be watching those events.  I've read that Visio wouldn't fire them if there were no handlers.  Is that true?  If it is I'll dig more into trying to find what has registered a handler.  Otherwise, I guess I'll just have to live with the lag.

Nikolay

Quote from: michelleh on January 21, 2011, 05:01:24 PM
Hi experts!  I have a .Net addon that generates a drawing with many complex shapes.  After the drawing is displayed and my code is done, Visio 2010 is still busy for several more seconds.  I investigated and found that Visio is sending FormulaChanged and CellChanged events during this time.  I uninstalled all other addons and removed watching these events from my addon, and the lag is still there.  Is there any way to stop this from happening?

Thanks!

As far as I know, if you subscribe to any event of a Visio-object in .NET using normal event handler syntax (like using VBA "WithEvents"), you got actually subscribed to ALL events of this object, it's just your code is not called, because you did not write event handler, but .NET code is still called by Visio, and the event is still fired.

If you do not want this to happen, you could consider using the "old-fashioned" Visio events mechanism, which allows more selectivity.
Read the "remarks" section of the EventList.AddAdvise method in Visio documentation.