Prevent moving line from a specific LinkPoint

Hi,
I like to prevent move of line endpoints connected to a specific LinkPoint on the FlowActionBlock. Tried with following code to add a restriction to the box LinkPoints[2].Anchor but the code crasch when I create next box and connect it with the last one.

NewBox := TFlowActionBlock.Create(TrpDiagram.Owner);
MyLine := TDiagramSideLine.Create(TrpDiagram.Owner);
with MyLine do
begin
Diagram := TrpDiagram;
SourceLinkPoint.AnchorLink := ParentBox.LinkPoints[3]; //link start point to someblock
TargetLinkPoint.AnchorLink := NewBox.LinkPoints[2]; // link end point to
NewBox.LinkPoints[2].Anchor.Restrictions := [crNoMove];
end;

What am I doing wrong here, is there another way?

/ Dag

I'm not sure what you want to achieve. If you don't the line to be moved at all, you can simply use

MyLine.Restrictions := [crNoMove, crNoResize];

In your code, NewBox.LinkPoints[2].Anchor is nil, because such link point is not anchored to any other link point. It's the MyLine link point which is anchored to NewBox, thus maybe what you are looking for is the NewBox.LinkPoints[2].Anchoreds property (which is a list, because you can have more than one external link points anchored to that specific NewBox link point.

I like to be able to move the line enpoint connected to the Right side of the box but not be able to move the enpoint connected to the left side of a box.
bild

You can disable a specific handle in a line, so it won't be movable:

  MyLine.SourceHandle.Visible := False;

Thank's Wagner, that works just fine.

By the way, your product is nice but I can't really say the same about the documentation.

Regards
Dag

1 Like