Blog

All Blog Posts  |  Next Post  |  Previous Post

Visualize TMS Planner event relations with arrows

Bookmarks: 

Monday, August 25, 2014

It's already for a longer time that our Planner scheduling components supports linking events. That means that when the start time or end time or both times of an event is changed, the start or end time of a linked event will also change. The change in start or end time of linked event will have the same delta as the source event. The link action of choice can be selected with PlannerItem.LinkType and offers following choices:

  • ltLinkFull: when start time and end time of the event is changed, the start and end time of the linked item also changes.
  • ltLinkBeginEnd: when the start time of an event is changed, the end time of the linked event also changes.
  • ltLinkEndBegin: when the end time of an event is changed, the start time of the linked event also changes.
  • ltLinkBeginBegin: when the start time of an event is changed, the start time of the linked event also changes.
  • ltLinkEndEnd: when the end time of an event is changed, the end time of the linked event also changes.
Now, it may not always be desirable that any type of linking will affect the start or end time of the linked item, a visualization might be sufficient. For this case, we have added the link type: ltNone. At the same time, a better visualization of linked items will also benefit "classic" linked items. Therefore, in the latest version of the TMS Planner, we went one step further and have now optionally visual connections with lines with arrows between linked events. To see how easy it is to set this up, imagine two events were created with the code:
var
  plit1,plit2: TPlannerItem;
begin
  plit1 := Planner1.CreateItem;
  plit1.ItemStartTime := EncodeTime(10,0,0,0);
  plit1.ItemEndTime := EncodeTime(12,0,0,0);
  plit1.ItemPos := 0;
  plit1.CaptionType := ctText;
  plit1.CaptionText := 'item 1';
  plit1.Text.Text := 'link from';
  plit2 := Planner1.CreateItem;
  plit2.ItemStartTime := EncodeTime(14,0,0,0);
  plit2.ItemEndTime := EncodeTime(16,0,0,0);
  plit2.ItemPos := 1;
  plit2.CaptionType := ctText;
  plit2.CaptionText := 'item 2';
  plit2.Text.Text := 'link to';
end;


When applying one link with code:
  plit1.LinkedItem := plit2;
  plit1.LinkType := ltLinkFull;
then moving or resizing the event "item 1" will result in event "item 2" also moving or resizing. Moving or resizing event "item 2" will not cause changes to event "item 1". When we'd want a bidirectional link, we'd initialize the link with:
  
  plit1.LinkedItem := plit2;
  plit1.LinkType := ltLinkFull;
  plit2.LinkedItem := plit1;
  plit2.LinkType := ltLinkFull;
In a next step, we'll visualize the link between items with arrow lines. To enable link visualization in the TMS Planner globally, set Planner.ShowLinks = true and set Planner.LinkArrowShape = asFilled when you want fully filled arrows instead of just arrows (asNormal). To have two events that are linked with an arrow line from one event to the other event without specific link relationship, setup the items with:
  plit1.LinkedItem := plit2;
  plit1.LinkType := ltLinkNone;
  plit1.LinkArrow := laFromTo;
  plit1.LinkColor := clGreen;
To have the arrows go in both directions, simply set the property LinkArrow to laBoth as in this sample:
  plitA.LinkedItem := plitB;
  plitA.LinkType := ltLinkNone;
  plitA.LinkArrow := laBoth;
  plitA.LinkColor := clRed;


We hope you'll find this new feature useful and you can benefit from it to create better applications for your customers. Check out this and more in the TMS Planner.

Bruno Fierens


Bookmarks: 

This blog post has not received any comments yet.



Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post