Book a Demo

Author Topic: EA.Attribute.TaggedValues.AddNew  (Read 6362 times)

bigcat

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
EA.Attribute.TaggedValues.AddNew
« on: February 26, 2009, 02:13:35 am »
Any one knows why the following statement can't cast the object to EA.TaggedValue? attr is  a EA.Attribute received by parameter.

EA.TaggedValue tv = (EA.TaggedValue)attr.TaggedValues.AddNew("tag name", "string");

AddNew is returning a non-null object. I just can't figure out what type it is. I guess it's not a TaggedValue since the cast fails.

Also, any hint on how to inspect COM objects in Visual Studio debugger, normal debug just shows System.__ComObject for all these.

bigcat

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: EA.Attribute.TaggedValues.AddNew
« Reply #1 on: February 26, 2009, 02:29:10 am »
Basically, what I want to accomplish is add tag values to a class attribute. I was hoping to get a taggevalue object, call Update on it, and so forth.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: EA.Attribute.TaggedValues.AddNew
« Reply #2 on: February 26, 2009, 04:33:21 am »
For reasons unknown to me, a tagged value on an attribute is of type EA.AttributeTag and not EA.TaggedValue.

As to the debugging problem: this is getting on my nerves too. Bloody COM. Guess you could write something using reflection to extract the underlying type, but so far I never had the time to try it out.

bigcat

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: EA.Attribute.TaggedValues.AddNew
« Reply #3 on: February 26, 2009, 05:28:22 am »
oh man thanks. I've been after this all day. How did you figure that out?
 Is information like this documented somewhere? Like an API reference guide, return types, etc... The user guide does not seem to include this.

Quote
For reasons unknown to me, a tagged value on an attribute is of type EA.AttributeTag and not EA.TaggedValue.

As to the debugging problem: this is getting on my nerves too. Bloody COM. Guess you could write something using reflection to extract the underlying type, but so far I never had the time to try it out.
« Last Edit: February 26, 2009, 05:29:42 am by bigcat »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: EA.Attribute.TaggedValues.AddNew
« Reply #4 on: February 26, 2009, 06:42:52 am »
It's there, but you have to read between the lines, adding some liberal doses of interpretation as you do.

Check under Element Features in the SDK portion of the documentation and help.

See also MethodTag, AttributeConstraint, and MethodConstraint for additional examples of this sort of thinking.
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: EA.Attribute.TaggedValues.AddNew
« Reply #5 on: February 26, 2009, 06:45:21 pm »
Quote
See also MethodTag, AttributeConstraint, and MethodConstraint for additional examples of this sort of thinking.

And ParameterTag, which you won't find cause it's missing (no automation support for tagged values on parameters).

Couldn't resist rubbing it in once more.

bigcat

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: EA.Attribute.TaggedValues.AddNew
« Reply #6 on: February 27, 2009, 12:33:26 am »
Thanks folks for the feedback. I appreciate it. These are the first few lines of EA plugin code I write; I am sure it'll feel better as I code more stuff.

BTW, attr.TaggedValues.Refresh() does not appear to work. I have to go to a different attribute and come back to see the newly added tags.

I'll continue to research the COM "viewer" issue at runtime/debug. I'll post if I find or do something about it.