Author Topic: How Do I Determine A Diagram Is Modified By User  (Read 4628 times)

Jeff Odell

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
How Do I Determine A Diagram Is Modified By User
« on: August 06, 2007, 02:20:48 pm »
My Add-In will update the elements in the current diagram and reload it to reflect the changes.  However, I want to make sure the user has saved changes to the diagram before they invoke my Add-In.  I scoured the API and haven;t located how to determin if the current diagram is in a changed state.

Can anyone enlighten me?

Thanks in advance - Jeff Odell

Jeff Odell

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: How Do I Determine A Diagram Is Modified By Us
« Reply #1 on: August 16, 2007, 09:08:05 am »
Sparx support reply:

Unfortunately there is no explicit method to find if the diagram is modified/dirty.  I can suggest two possible solutions however, but neither of which are probably perfect...

1) Simply call Repository.SaveDiagram and save the diagram regardless.
Assume that if the user is calling this function that they intend to work with the diagram in it's current state.

2) Use Repository.IsTabOpen to detect if a tab is open matching the diagram's name and the asterisk character (representing the modified status).

For Example:

Public Function DiagramIsModified(ByRef rep As EA.Repository, ByRef diag As EA.Diagram) As Boolean
   DiagramIsModified = rep.IsTabOpen("*" & diag.name) End Function

The second solution may have some problems however, mainly that if two diagrams with the same name are open, you could get false positives.