Author Topic: Info: Reflect Tagged Value changes from AddIn  (Read 2655 times)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Info: Reflect Tagged Value changes from AddIn
« on: April 05, 2012, 08:22:18 am »
Just to give as info for other users that may be struggling with this.
I have a sterotyped element from an MDG profile where the _Tag attribute of the metaclass is set to show the tagged value compartment by default.
After setting a tagged value using the EA_OnPostNewElement() and return true, the tagged value compartment disappeared in the diagram where the element was dropped. Returning false from the event method retains the tagged value compartment, but the changes in the tagged value were not shown in the diagram.
The following (C#) code helped reflecting the tagged value changes:
Code: [Select]
public bool EA_OnPostNewElement(EA.Repository repository, EA.EventProperties eventProperties)
{
    EA.Element element;
    EventPropertiesHelper evProperties = new EventPropertiesHelper(repository,eventProperties);
    if(evProperties.GetElement(out element))
    {
        EA.TaggedValue myTaggedValue = element.TaggedValues.GetByName("MyTaggedValue") as EA.TaggedValue;
        if(myTaggedValue.Value == "")
        {
             myTaggedVAlue.Value = "Some value";
             repository.RefreshOpenDiagrams(false);
        }
    }
    return false; // !!!!
}

Best regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Info: Reflect Tagged Value changes from AddIn
« Reply #1 on: April 05, 2012, 07:50:18 pm »
Just see my various complaints about OnPost methods in the bugs list...

q.

[edit:] Just saw that you already read it. However, this does not help. Just for the fun try what I described with connectors and elements. I'm pretty sure any other operation/diagram or whatever is allowed with the OnPost will behave differently and inconsistent.
« Last Edit: April 05, 2012, 07:58:03 pm by qwerty »