Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Alex on May 19, 2005, 01:48:58 pm
-
Hi,
I can connect to repository, load tree of packages, for each package I can load list of elements, but
1) All elements have empty stereotype;
2) element's TaggedValues collection is always NIL;
3) I have access violation error while access to element's Methods or Attributes collections.
The next is my simplified code
procedure ShowPackage(pkg: IPackage);
var
i: integer;
coll: ICollection;
begin
Memo1.lines.Add(pkg.Name);
coll := pkg.Elements as ICollection;
for i:=0 to coll.Count-1 do
ShowElement(coll.GetAt(i) as IElement);
end;
procedure ShowElement(elm: IElement);
var
i: integer;
coll: ICollection;
tv: ITaggedValue;
d: IDispatch;
begin
Memo1.lines.Add(elm.Name); // works fine
Memo1.lines.Add(elm.Stereotype); // always blank :(
coll := elm.TaggedValues as ICollection;
if coll<>nil then // always NIL :(
for i:=0 to coll.Count-1 do ;
d := elm.Methods;
coll := d as ICollection; // access violation error :(
d := elm.Attributes;
coll := d as ICollection; // access violation error :(
end;
Thanks,
Alexander Zemerov.
-
Solved!
After I replaced interface types in my code to "Dual" ones (i.e. ICollection -> IDualCollection) everething is fine.
In EA_TLB.pas ICollection is declared as "dispinterface" and IDualCollection is declared as "interface (IDispatch)".
I'm not proficient in COM, so if enybody can explain while dispinterface doesn't work, I will be glad.
Alexander Zemerov.