Author Topic: SelectedObjects Type  (Read 3426 times)

RoyClem

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
SelectedObjects Type
« on: January 14, 2005, 09:02:58 am »
In the Diagram class, there is a collection called SelectedObjects.

What is the type of the objects within it?

I tried casting to the Element type, but received an exception.

Thanks!

Roy

RoyClem

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: SelectedObjects Type
« Reply #1 on: January 14, 2005, 10:27:22 am »
Apparently, SelectedObjects returns a DiagramObject.

Here's the code I used to retrieve the name of a selected element on a diagram.

Note, I pass the EA repository to the method as an argument.

EA.Diagram m_EADiagram  =    
                          m_EARepository.GetCurrentDiagram();

EA.Element m_EAElement  =   null;
EA.DiagramObject m_EADiagramObject;

for( short i = 0; i <  
     m_EADiagram.SelectedObjects.Count; i++ )
{
   m_EADiagramObject =  (EA.DiagramObject)  

   m_EADiagram.SelectedObjects.GetAt(i);

   m_EAElement = m_EARepository.GetElementByID
                               (m_EADiagramObject.ElementID);
             
    MessageBox.Show(m_EAElement.Name);
}