Author Topic: Decide if a DiagramObject or an Element is deleted  (Read 2976 times)

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Decide if a DiagramObject or an Element is deleted
« on: May 30, 2008, 06:36:52 pm »
Hi,

i'd like to use the method "EA_OnPreDeleteElement()" to deside if the output has to be changed or not.

How can I check if only a DiagramObject or an Element (Class) will be deleted?

The EventProperties variable only contains the ElementID and a check if the Element exsits doesn't work, because it is a pre deletion event.

Thanks
TheTwo
« Last Edit: May 30, 2008, 07:07:32 pm by TheTwo »

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Decide if a DiagramObject or an Element is del
« Reply #1 on: May 30, 2008, 07:37:18 pm »
Is the EA_OnPreDeleteElement actually fired when a user only deletes an element from a diagram?

Help says

Quote
EA_OnPreDeleteElement notifies Add-Ins that an element is to be deleted from the model

but then it says

Quote
This event occurs when a user deletes an element from the Project Browser window or on a diagram

I take the second to mean that the event is fired when a user presses Ctrl+Del for an element selected in a diagram. This would mean, however, that you get no event at all when the user only removes an element from a diagram.

TheTwo

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Decide if a DiagramObject or an Element is del
« Reply #2 on: May 30, 2008, 07:55:21 pm »
The problem is that when deleting only an DiagramObject from an Diagram with Del the event is fired, too.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Decide if a DiagramObject or an Element is del
« Reply #3 on: May 30, 2008, 08:45:36 pm »
Quote
The problem is that when deleting only an DiagramObject from an Diagram with Del the event is fired, too.

This is a downright bug then, cause documentation explicitly states that the event is fired when an element is about to be deleted from the model.

Or maybe only documentation is wrong, and the event is supposed to be fired in this case as well. But then the ElementID in the event properties should actually be the InstanceID of the DiagramObject.