Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Removing event handlers from objects during undo

nshupeFMPE3
Advocate
Advocate

Removing event handlers from objects during undo

nshupeFMPE3
Advocate
Advocate

I have a command where I add xdata and event handlers to a selected polyline. But when I undo that command, the objects still react to the event handlers. 

Why aren't the event handlers being removed during the undo?

0 Likes
Reply
Accepted solutions (1)
405 Views
1 Reply
Reply (1)

nshupeFMPE3
Advocate
Advocate
Accepted solution

I think I have solved my problem. During the undo the event handlers fire, I check to see if the object is open for undo. If it is I just exit the event handler. Then later in the event handler method I check if the object should still have the event handlers, in my case whether the object has xdata that I want, if it does not, then it should not have the event handler and the handler is removed. I was trying to remove it while it was open for undo, but I think it had to be removed later when it wasn't open for undo

0 Likes