Adding Event Handler - Delete Graphic Element

385
2
09-04-2013 05:26 PM
Highlighted
Occasional Contributor III
Hey all,

I've got a quick question regarding event handlers. I have a program to lock and unlock graphic elements in the page layout (text, etc...).

The issue is that "locked" (IElement.Locked = True) elements, can still be deleted, which I would like to prevent.

I have the code to prevent the delete, however I don't know how to add the actual event handler so that when I try to delete a locked element, it catches it and prevents it.

I guess this event handler should work independently of the actual lock/unlock Add-In, however I'm lost at where to begin.

Any assistance would be greatly appreciated (I'm a bit of an amateur at all of this so more detail is better).

Thanks, and let me know if more information is required for this.
Reply
0 Kudos
2 Replies
Highlighted
Regular Contributor III
The IGraphicsContainerEvents interface has the event you're looking for.  You may not be able to prevent the actual delete from taking place but you can probably just add the element back.
Reply
0 Kudos
Highlighted
Occasional Contributor III
Thanks Neil,

I'll look at implementing this. Related question: do you know of any current issues with IElement.Locked?

I know that many years ago there was a bug associated with it, but I have no details (other than an old bug number which I'm unable to find any info on). I was curious if you (or anyone else) know of anything currently wrong with this property.

Thanks again!
Reply
0 Kudos