Trapping any modification with AddAdvise

D

Daniel Shookowsky

I need to catch any attempt to modify the current Visio document and
automatically check the VSD file and a related file out of source control.
If the user cancels the checkout or the checkout fails, I'd like to
return false from my eventsink to cancel the document change.

I've attempted to use various combinations of visEvtDel, visEvtMod, and
visEvtAdd with no luck so far. Does anyone know of a catch-all event that
would do what I'm trying?

Is there another means of preventing changes until the document is checked
out?
 
C

Chris Roth [ Visio MVP ]

CellChanged at the document level will trap a huge majority of things that
can be done to Visio, since just about everything is linked to a ShapeSheet
cell.

Things not linked to the ShapeSheet are View/UI options (no effect on
document), document properties (File > Properties), Data123 for shapes. And
there's probably more.

I know that the Document.Saved (= True/False) property tells you if a
document has been changed. But it's not an event.

I suppose you could check Document.Saved in visApp.NoEventsPending, or
visApp.VisioIsIdle. These events fire very often.

The thing is, the user would always get away with at least ONE modification.

Can you just ask them when they open the drawing if they want to edit or
view?

Perhaps people who just want to view could open the drawing using the Visio
Viewer, available for free for IE...

--

Hope this helps,

Chris Roth
Visio MVP
 
D

Daniel Shookowsky

CellChanged at the document level will trap a huge majority of things that
can be done to Visio, since just about everything is linked to a ShapeSheet
cell.

Things not linked to the ShapeSheet are View/UI options (no effect on
document), document properties (File > Properties), Data123 for shapes. And
there's probably more.

I know that the Document.Saved (= True/False) property tells you if a
document has been changed. But it's not an event.

I suppose you could check Document.Saved in visApp.NoEventsPending, or
visApp.VisioIsIdle. These events fire very often.

The thing is, the user would always get away with at least ONE modification.

Can you just ask them when they open the drawing if they want to edit or
view?

Perhaps people who just want to view could open the drawing using the Visio
Viewer, available for free for IE...

Thank you for your reply. I neglected to mention a few things. My
current solution is a .NET application using the Visio 2003 AxDrawing
control. As such, I am able to remove much of the built-in functionality
of Visio.


I think that the CellChanged event will work for my purposes when
combined with ShapeAdded and BeforeShapeDelete. This combination should
catch new shapes, movement of shapes, connection modifications, and shape
deletion. I'm not as worried about changing pages and I can capture and
prohibit page insertion or deletion when those events fire.

Is there any good rationale for the events that are included vs. those
excluded in Visio? I find it somewhat odd that useful events like
doubleclick and BeforeUpdate aren't available, but NoEventsPending and
VisioIsIdle are there.
 
C

Chris Roth [ Visio MVP ]

Well, with the Visio control, you'll have a lot more, er, control over what
the user messes with.

The rationale for events? Well, the app is over 10 years old, so you have
historical considerations, plus lots of "not enough time to implement"
stories.

The mouse-over/move events are relatively new to Visio. I can only hope that
more events such as these are coming.

--

Hope this helps,

Chris Roth
Visio MVP
 

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