Page 1 of 1

List of GraphLink (SimpleGraph)

PostPosted: January 28th, 2012, 6:20 pm
by neverush
Hi All,
In run-time I need to receive list of all GraphLinks only (without GraphNodes and other). I have to operate this list next (using text properties). Further work goes with use of arrays. How can I do it? (SimpleGraph 2.8, Codegear Delphi 2007)

Re: List of GraphLink (SimpleGraph)

PostPosted: January 28th, 2012, 7:23 pm
by neverush
I can answer to me myself. Perhaps it will help to somebody.

Code: Select all
procedure TMainForm.ListOfGraphLink(Sender: TObject);
var
  I, M: Integer;
  LinkArray: Array of TGraphLink;
begin
  M := 0;
  SetLength(LinkArray, SG1.ObjectsCount(TGraphLink));
  for I := 0 to SG1.Objects.Count - 1 do
    if SG1.Objects[I] is TGraphLink then
      begin
        LinkArray[M] := TGraphLink(SG1.Objects[I]);
        M := M + 1;
      end;
end;