10552 : How do I to control the links with delphi

Question

How do I to control the links with the VCL version?

Answer

This is a code snippet showing how to enter the link create mode in Delphi. The link create mode (smDependency) allows the user to click one time item and drag out a link to another time item in order to create the depency link:

procedure TForm1.SpeedButtonLinkClick(Sender: TObject);
begin

  // Enter depenency create mode… Will stay in this mode until link created
  phGant1.StickyMode:=smDependency;
end;

procedure TForm1.phGant1DependencyAction(theFirst,
  theSecond: TphDataEntity_GantTime);
var
  aLink:TphDataEntity_Link;
begin

  // Leave the sticky mode
  phGant1.StickyMode:=smNone;

  aLink:=phGant1.AddLink;
  aLink.LinkOwner:=theFirst;
  aLink.LinkedTo:=theSecond;

  aLink.LinkStyle:=phGant1.DefaultLinkStyle;
  aLink.LinkColor:=phGant1.DefaultLinkColor;
  aLink.LinkPenWidth:=phGant1.DefaultLinkPenWidth;

end;