Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Gerhard

Pages: [1]
1
Quote
The code is absolutely correct. The DeleteAt has the False parameter to indicate that the index is not to be changed. Only after invoking refresh, the index should be renumbered. So I think this is a bug and should be reported to Sparx.


Hi, Thanks for your reply.

What is the procedure to report bugs to the author?

Thanks
Regards

2
Quote
It doesn't work here either. I once had an issue related to collections.

Maybe the DeleteAt is not implemented correctly?


Hi,

Maybe, Im not sure, however my code is based on the sample code EA installs : \Code Samples\VB_Sample\VB_Sample.frm

So it should work ???

Thanks
Regards



3
Quote
I'm not really into VB, but the collection handling isn't really correct. Once you delete one item from the collection, the 'k' index that you use already points to the next item. You might at least consider decreasing k with one when a delete has been issued. And I'm not sure if the "MyElement.Constraints.Count - 1" is evaluated once (at the start) or every time the loop starts. If it's the first case and you delete one item, your index 'k' runs higher than the collection size.


Hi,

I See your point, but that part was taken from the sample code on the default EA instalation.

However I have thought of that. If instead of the loop I simply put "DeleteAt 0, False" (knowing it exists constraints) it gives the same error! So It's not due to the index loop :(

thanks for your reply
Regards

4
Hi, I have the following code in a macro in WORD:


Sub CleanConstraints()
'
' CleanConstraints Macro
' Macro created 21-03-2005
'
   Dim App As Object
   
   Dim counter As Integer
   Dim i As Integer
   Dim J As Integer
   Dim k As Integer
   Dim MyModel As Object
   Dim MyPackage As Object
   Dim MyElement As Object
       
   Set App = CreateObject("EA.APP")
   App.Repository.OpenFile ("teste.EAP")
   
   For counter = 0 To App.Repository.Models.Count - 1
      Set MyModel = App.Repository.Models.GetAt(counter)
      For i = 0 To MyModel.Packages.Count - 1
     
         Set MyPackage = MyModel.Packages.GetAt(i)
         For J = 0 To MyPackage.Elements.Count - 1
             Set MyElement = MyPackage.Elements.GetAt(J)
             
             If MyElement.Stereotype = "table" Then
                 Set ob = MyElement.Constraints.AddNew("Appended", "Type")
                 ob.Update
                 For k = 0 To MyElement.Constraints.Count - 1
                   Set ob = MyElement.Constraints(k)
                   If ob.Name = "Appended" Then
                      MyElement.Constraints.DeleteAt k, False
                   End If
                Next
             End If
         Next
      Next
   Next
   App.Repository.CloseFile
End Sub


When it reaches Constraints.deleteAt it gives an Internal Application Error.

This also happens in Delphi, with the same code

I did not test it with VB, only Delphi and VBA. I guess there is some problem with the automation collection's ?

I'm using the latest trial version

can somebody test this? or give an hint?

Thanks a lot
Regards

5
Hi all,

I have imported several Delphi forms into EA, but from time to time I need to update this forms in EA with the information I have in my project.

I did a small programe which iterates thought the elements and if it's a form I try to synchronize it with the IsSynchronized method of the element. However this does nothing, either setting it to true or false and then call update.

My question is, is there a away to programmatically synchronize a object? This can be achieved in EA by right clicking and choose "Synchronize Model" However this feature does not seem to be available in the Automation API.

Can Somebody give me a hint on how to do this?

Thank you
Regards

Pages: [1]