Book a Demo

Author Topic: Event for New, Delete, what about change?  (Read 4105 times)

bioform

  • EA User
  • **
  • Posts: 230
  • Karma: +0/-0
  • Forty-Two?
    • View Profile
Event for New, Delete, what about change?
« on: July 14, 2009, 03:19:56 pm »
Is there a broadcast event for when an element is changed?

I would like my add-in to be able to respond before a change to an element is committed... e.g., Trap change to the "Alias" field.

<EA_OnNotifyContextItemModified>
I'm a little fuzzy on this as it does not seem to indicate WHAT of the element was changed?

Thanks,
David
« Last Edit: July 14, 2009, 03:40:13 pm by bioform »
Time is what keeps everything from happening at once, Space is what keeps it all from happening to you. <unknown>

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Event for New, Delete, what about change?
« Reply #1 on: July 15, 2009, 01:32:16 am »
Hi David,

I recently came over the same problem.
I think <EA_OnNotifyContextItemModified> is the only event you can use to capture modifications. To be able to know what has changed you may capture the <EA_OnNotifyContextItemChanged> event, that occurs whenever a new item is selected in the UI. At that point you can store the actual values you want to survey. In the implementation of <EA_OnNotifyContextItemModified> you can check if the actual values of the item are different from your stored one's.
In reality it's a bit more complex, since you may get a ContextItemModified event for a parent item, e.g. changing an attribute using the Attributes Dialog may notify about modification of the containing class element.

HTH
Günther

gilles2

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Event for New, Delete, what about change?
« Reply #2 on: August 08, 2009, 01:32:06 am »
Hi Makulik,

I managed to compare old version and newer one of an element using both events contextitemchanged and itemmodified with a stack (to take into account element parent).

But did you find a way to overwrite the new object with the old one ? without having to do it for each property of the element ??

Gilles