I have a function for setting the values listed.
It's going well everywhere. Except TDBTimeLineSource. Only one day is displayed. I must to set the Period again.
The StartDate and EndDate values are OK. At the end of the function are not changed!
I have no idea if it's a mistake.
procedure TRolePlanner.SetTimes(const I: Integer);
const
SideBarTop = 2;
DisplayScale24 = 24;
DspStrH = 0; DspStrM = 1; DspEndH = 2; DspEndM = 3; ActStrH = 4; ActStrM = 5; ActEndH = 6; ActEndM = 7;
var
Dsp: TPlannerDisplay;
RowsPerHour: Integer;
HourMin: array [0..7] of Word;
begin
if not Assigned(FTimes[I].TimeLine) then
begin
FPlannerDay.Mode.TimeLineNVUBegin := 0;
FPlannerDay.Mode.TimeLineNVUEnd := 0;
Exit;
end;
//Test of Dates ShowMessage(DateToStr(TDBTimeLineSource(FPlannerDay.ItemSource).StartDate)+' - '+
//DateToStr(TDBTimeLineSource(FPlannerDay.ItemSource).EndDate));
Dsp := FPlannerDay.Display;
Dsp.DisplayUnit := FDisplayUnit[FTimes[I].TimeLine.ItemIndex];
RowsPerHour := (MinsPerHour div Dsp.DisplayUnit);
HourMin[DspStrH] := HourOf(FTimes[I].DisplayStart.Time);
HourMin[DspStrM] := MinuteOf(FTimes[I].DisplayStart.Time);
Dsp.DisplayStart := Round(HourMin[DspStrH] + (HourMin[DspStrM] / MinsPerHour)) * RowsPerHour;
HourMin[DspEndH] := HourOf(FTimes[I].DisplayEnd.Time);
HourMin[DspEndM] := MinuteOf(FTimes[I].DisplayEnd.Time);
Dsp.DisplayEnd := Round((HourMin[DspEndH] + (HourMin[DspEndM] / MinsPerHour)) * RowsPerHour) - 1;
HourMin[ActStrH] := HourOf(FTimes[I].ActiveStart.Time);
HourMin[ActStrM] := MinuteOf(FTimes[I].ActiveStart.Time);
Dsp.ActiveStart := Round(((HourMin[ActStrH] + (HourMin[ActStrM] / MinsPerHour)) - (HourMin[DspStrH] +
(HourMin[DspStrM] / MinsPerHour))) * RowsPerHour);
HourMin[ActEndH] := HourOf(FTimes[I].ActiveEnd.Time);
HourMin[ActEndM] := MinuteOf(FTimes[I].ActiveEnd.Time);
Dsp.ActiveEnd := Round(((HourMin[ActEndH] + (HourMin[ActEndM] / MinsPerHour)) - (HourMin[DspStrH] +
(HourMin[DspStrM] / MinsPerHour))) * RowsPerHour);
FPlannerDay.Mode.TimeLineNVUBegin := Round(HourMin[DspStrH] * (MinsPerHour / Dsp.DisplayUnit));
FPlannerDay.Mode.TimeLineNVUEnd := Round((HourMin[DspEndH] - HourMin[ActEndH]) * (MinsPerHour / Dsp.DisplayUnit)) + 1;
//ShowMessage(DateToStr(TDBTimeLineSource(FPlannerDay.ItemSource).StartDate)+' - '+
//DateToStr(TDBTimeLineSource(FPlannerDay.ItemSource).EndDate));
end;