diff --git a/components/tvplanit/source/vpganttview.pas b/components/tvplanit/source/vpganttview.pas index 940f99c4c..36d3d42c3 100644 --- a/components/tvplanit/source/vpganttview.pas +++ b/components/tvplanit/source/vpganttview.pas @@ -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