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
Using a non-linear time axis

In some situations, it is not desirable that the time axis is divided in equal units. With the TPlanner put in plCustomList mode, the possible times for scheduling an event can be defined to avoid this. To handle the plCustomList mode, the TPlanner has a property TPlanner.DateTimeList. Following methods are defined:

TPlanner.DateTimeList.Clear;  //clears all datetime info from the list.
TPlanner.DateTimeList.Add(dt: TDateTime);  //adds a datetime value to the list
TPlanner.DateTimeList.Insert(Index: Integer; dt: TDateTime); // inserts a datetime value to the list
TPlanner.DateTimeList.Delete(Index: Integer);  //deletes the datetime at position Index from the list
TPlanner.DateTimeList.Items[Index]:  //TDateTime; returns the datetime values in the list
Example: setup the TPlanner through the DateTimeList in plCustomList mode
// setup of the DateTimeList
with Planner.DateTimeList do
begin
  Add(encodetime(8,0,0,0));
  Add(encodetime(9,30,0,0));
  Add(encodetime(11,00,0,0));
  Add(encodetime(12,30,0,0));
  Add(encodetime(13,30,0,0));
  Add(encodetime(14,45,0,0));
  Add(encodetime(16,00,0,0));
  Add(encodetime(17,15,0,0));
end;

// setup of the number of cells to display and cellheight
with Planner.Display do
begin
  DisplayStart := 0;
  DisplayEnd := 7;
  DisplayScale := 60;
end;
This results in the planner as:

When programmatically inserting an item, this can be done with:

with Planner.CreateItem do
begin
  itemstarttime := encodetime(11,0,0,0);
  itemendtime := encodetime(12,30,0,0);
end;