Restricting line to be connected

I would like to restrict lines on the drawing all to be connected to linkpoints, and after that also restrict which linkpoints can be joined.

I started to code the OnAcceptLink event handler, but I discovered that this event is never fired if I draw a line in the middle of nowhere. without connection any blocks.
Any suggestion ?

Use property RequiresConnections to prevent lines to be inserted without being connected to some link point. Then continue using OnAcceptLink to filter which link points are accepted or not.

Where can I set it ? Is there any event fired when the Link is going to be created ?

RequiresConnection is a property of TDiagramLine object. You must set it for each line in your diagram.

Event OnInsertLink is fired whenever a new line is added to the diagram.

I've tried adding 

in the OnInsertLink event, but the editor still allows me to draw connections on an empty diagram.
I'm using the latest version with delphi 7.

This should work. Can you send me a compilable project through support e-mail so I can check what is wrong?

I'll package and send it, I think this 2 pics says it all...

Problem is when the OnInsertLink is called the line is already inserted. You must set Requiresconnections before the line is inserted. Here is one way of doing that:

  TMyDiagramLine = class(TDiagramLine)
    constructor Create(AOwner: TComponent); override;

constructor TMyDiagramLine.Create(AOwner: TComponent);
  RequiresConnections := true;

procedure TForm1.FormCreate(Sender: TObject);
  // Replace TDiagramLine type by my own TMyDiagramLine
  RegDControlList.FindByID('TDiagramLine').DControlClass := MyDiagramLine;

ok that works thaks!