tvplanit: Fix GanttView being unable to select a recurring event.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8560 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-10-14 21:17:20 +00:00
parent 063b3a73c3
commit 15639aae1a

View File

@ -1218,13 +1218,25 @@ end;
function TVpGanttView.GetRowOfEvent(AEvent: TVpEvent): Integer;
var
i: Integer;
eventRec: PVpGanttEventRec;
found: Boolean;
begin
for i := 0 to FEventRecords.Count-1 do
if FEventRecords[i]^.Event = AEvent then
begin
eventRec := FEventRecords[i];
if (eventRec^.Event = AEvent) then
begin
Result := i;
exit;
if AEvent.RepeatCode = rtNone then
found := true
else
found := (DatePart(eventRec^.StartTime) <= FActiveDate) and (DatePart(eventRec^.EndTime) >= FActiveDate);
if found then
begin
Result := i;
exit;
end;
end;
end;
Result := -1;
end;
@ -1591,7 +1603,13 @@ begin
// Find the active row. This is the row with the active event.
if eventRec^.Event = FActiveEvent then
FActiveRow := i;
begin
if FActiveEvent.RepeatCode = rtNone then
FActiveRow := i
else
if (DatePart(eventRec^.StartTime) <= FActiveDate) and (DatePart(eventRec^.EndTime) >= FActiveDate) then
FActiveRow := i;
end;
// Prepare for next row
y1 := y2;
@ -1843,6 +1861,7 @@ begin
ScrollDateIntoView(FActiveDate);
FActiveCol := trunc(FActiveDate) - trunc(FRealStartDate);
Invalidate;
if (not FInLinkHandler) and (ControlLink <> nil) then
@ -1851,6 +1870,8 @@ begin
end;
procedure TVpGanttView.SetActiveEvent(AValue: TVpEvent);
var
i:Integer;
begin
if FActiveEvent <> AValue then
begin