Book a Demo

Author Topic: Deleting Attributes when using EA New Events  (Read 3529 times)

bachus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Deleting Attributes when using EA New Events
« on: August 13, 2014, 07:02:40 pm »
hello !

I'm currently struggling with the EA Post-New Events and EA Pre-New Event.
In a c# Add-in, I'm checking if the right attribute is apply on the right element, using theirs stereotypes.

I try to use the function EA_OnPostNewAttribute which work correctly to do some tests and modifications on the attributes proprieties.
But I didn't manage to "not apply" the attribute if I don't want to (returning false in that case). Which seems normal as the Attribute is already created...
So I try to erase this attribute, but I did not succeed.  :(
-> Which method should I use to erase an attribute knowing is ID and is parentID ?

As it didn't work with that function, I try to use the EA_OnPreNewAttribute. It seems perfect in the first case, as it allows to add or not add the attribute before it is created ! But I didn't manage to change the proprieties, so it became useless...
In the function it is possible to change the attributes proprieties, but the changes are not took into account then the attribute is created.
-> is there a way to change the attributes proprieties using this function ?


Any help is welcome !  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Deleting Attributes when using EA New Events
« Reply #1 on: August 13, 2014, 08:35:16 pm »
I guess you will need some internal storage and check both events. The PRE to eventually block creation and the POST to modify things afterwards.

q.

bachus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Deleting Attributes when using EA New Events
« Reply #2 on: August 13, 2014, 09:25:54 pm »
What was my opinion too. But I would like to avoid the use of global variable...

Thanks for the fast answer !  

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Deleting Attributes when using EA New Events
« Reply #3 on: August 13, 2014, 09:42:28 pm »
IIRC similar topics had been discussed here and Geert suggested this approach too.

q.