Book a Demo

Author Topic: Problem retrieving current Diagram  (Read 3639 times)

assato

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Problem retrieving current Diagram
« on: March 07, 2007, 03:10:32 pm »
Hi

I'm trying to write a VB macro where the Repository.GetCurrentDiagram() would be useful. I'm able to use the Repository.GetTreeSelectedPackage(), so the code should be ok.

However, when I use the GetCurrentDiagram(), the selected Diagram isn't returned. Any idea what the problem might be?

Regards
Askild

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Problem retrieving current Diagram
« Reply #1 on: March 07, 2007, 03:35:28 pm »
GetCurrentDiagram should provide you with the currently opened diagram.  It is not affected by what is selected in the Project Browser window.  If you want to get the current selection in the Project Browser, regardless of the type, use Repository.GetTreeSelectedItem.  The object parameter should become set with the selected object, and the type enumeration will be given as a return value from the function.

For example:
Dim obj as Object
If (repository.GetTreeSelectedItem(obj) = otDiagram) Then
 Dim d as EA.Diagram
 Set d = obj
 ...
End If

See:
http://www.sparxsystems.com.au/EAUserGuide/repository3.htm
http://www.sparxsystems.com.au/EAUserGuide/objecttypeenum.htm