Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TPlanner
Linking TPlannerItems

A TPlannerItem can be linked in various ways to another TPlannerItem. Linking two items means that if the user will move or size one item, the linked item will also move or size. Linking is achieved through 2 TPlannerItem properties :
TPlannerItem.LinkedItem: TPlannerItem; defines to which the item is linked
TPlannerItem.LinkType: TPlannerLinkType; defines the type of the link
The LinkType can be :

ltLinkFull: both ItemBegin and ItemEnd are linked. This means that item duration is always synchronised between the items. When the item moves or sizes, both begin and end of the linked item will do the same move or size.
ltLinkBeginEnd: ItemBegin of the item is linked to the ItemEnd of the linked item. This means that if the ItemBegin of the item changes, the ItemEnd of the linked item will change with the same delta
ltLinkEndBegin: ItemEnd of the item is linked to the ItemBegin of the linked item
ltLinkEndEnd: ItemEnd of the item is linked to the ItemEnd of the linked item
ltLinkBeginBegin: ItemBegin of the item is linked to the ItemBegin of the linked item

Example:

In this example, two events need to be planned: a release of the software and the shipping of software to distributors. It is clear that shipping to distributors can only happen after the software release and that if the software release is delayed, the shipping will be delayed as well. Therefore, the two events are added in the planner with a link between the ItemEnd of the software release to the ItemBegin of the software shipping.
var
  plIt1,plIt2: TPlannerItem;
begin
  plIt1 := planner1.CreateItem;
  with plIt1 do
  begin
    ItemStartTime := EncodeDate(2002,7,15);
    ItemEndTime := EncodeDate(2002,7,20);
    ItemPos := 0;
    Text.Text := 'Release of version 1.0';
  end;
  plIt2 := planner1.CreateItem;
  with plIt2 do
  begin
    ItemStartTime := EncodeDate(2002,7,21);
    ItemEndTime := EncodeDate(2002,7,22);
    ItemPos := 1;
    Text.Text := 'Ship CD and manuals';
  end;

  plIt1.LinkedItem := plIt2;
  plIt1.LinkType := ltLinkBeginEnd;
end;
The result in the planner grid is:

delaying the software release by 3 days automatically moves and delays the shipping: