All sample code is implicit example when programming procedural code I'm at a loss.
For example when adding a rectangle in code that would look like ...
MyVirt.X := 100;
MyVirt.Y := 100;
Pt := SimpleGraph.ScreenToClient( MyVirt );
SimpleGraph.DefaultNodeClass := TRectangularNode;
SimpleGraph.CommandMode := cmInsertNode;
NodeRect.TopLeft := SimpleGraph.ClientToGraph(Pt.X, Pt.Y);
NodeRect.Right := NodeRect.Left + NewNodeWidth;
NodeRect.Bottom := NodeRect.Top + NewNodeHeight;
SimpleGraph.InsertNode(NodeRect, TRectangularNode);
This still works in the new component
However
SimpleGraph.LinkNodes( TGraphNode(SimpleGraph.Objects [SimpleGraph.ObjectsCount(nil) - 1]), TGraphNode(SimpleGraph.Objects [SimpleGraph.ObjectsCount(nil) - 2]), nil);
no longer is supported or works in a complete different way
I'm now trying something like this
if ( SimpleGraph.Objects.Items[ AlleGraphNodes - 1].ClassType = TRectangularNode ) and
( SimpleGraph.Objects.Items[ AlleGraphNodes - 2].ClassType = TRectangularNode ) then
begin
FromObject := SimpleGraph.Objects [SimpleGraph.ObjectsCount(nil) - 1];
ToObject := SimpleGraph.Objects [SimpleGraph.ObjectsCount(nil) - 2];
// showmessage ('laatste twee zijn TRectangularNode --> maak een link !!');
SimpleGraph.Objects.Add( TGraphLink.create() );
TGraphLink(SimpleGraph.Objects.Last).Source := FromObject;
TGraphLink(SimpleGraph.Objects.Last).Target := ToObject;
TGraphLink(SimpleGraph.Objects.Last).Text := 'hallo dit is een test';
end;
To create a link between the last two GraphObjects that are rectangulars ...
It does not work ...
any suggestions to put me on the right track are welcome .. An other option for me is to fall back on the previous version ... but hey