Book a Demo

Author Topic: Problem to get a diagram's selected object(s)  (Read 4893 times)

heba

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Problem to get a diagram's selected object(s)
« on: March 15, 2015, 10:32:58 am »
Hi all,

I'm currently trying to work with the selected object in a diagram. I want to modify the object from my Add-In after right click.

In TreeView this works fine. In Diagram I start with:
Code: [Select]
EA.Diagram Diagram = Repository.GetCurrentDiagram();
if (Diagram.SelectedObjects.Count == 1)
{
  Object Element = Diagram.SelectedObjects.GetAt(0);
  ...

Now Element is not null but it's also nothing to be successfully casted into EA.Element or something I can use to modify the class.

What might I've been missing in the documentation?  How can I get an EA element out of this collection which can be modified?

Many thanks,
Heiko

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Problem to get a diagram's selected object(s)
« Reply #1 on: March 15, 2015, 12:50:17 pm »
It should be an EADiagramObject which contains the element ID as reference.

q.
« Last Edit: March 15, 2015, 12:50:31 pm by qwerty »

heba

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: Problem to get a diagram's selected object(s)
« Reply #2 on: March 16, 2015, 12:18:50 am »
Works fine, thanks!  Never came to the idea that these objects are something different than the "regular" EA objects.  :(

-Heiko

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Problem to get a diagram's selected object(s)
« Reply #3 on: March 16, 2015, 04:14:18 am »
Well, they need to be something different. An element can appear at more than one place and each place has different positions (at least it should be possible to make them different  ;)).

q.