diff --git a/components/jvcllaz/run/JvJans/jvyeargrid.pas b/components/jvcllaz/run/JvJans/jvyeargrid.pas index 5560caa32..641f58964 100644 --- a/components/jvcllaz/run/JvJans/jvyeargrid.pas +++ b/components/jvcllaz/run/JvJans/jvyeargrid.pas @@ -295,7 +295,7 @@ var AYear, AMonth, ADay: Word; begin inherited Create(AOwner); - + FCellMargins := TJvRect.Create; FCellMargins.Top := 2; FCellMargins.Left := 2; @@ -998,20 +998,15 @@ var ADate: TDate; InfoText: string; InfoColor: TColor; -// Month, Day: Word; MonthIndex, DayIndex: Integer; CanSelect: Boolean; begin + Result := False; + CanSelect := True; if Assigned(OnSelectCell) then OnSelectCell(Self, ACol, ARow, CanSelect); - if not CanSelect then - begin - Result := False; - Exit; - end; - Result := False; - if (ACol < 1) or (ARow < 1) then + if (not CanSelect) or (ACol < 1) or (ARow < 1) then Exit; ColRowToDayMonthIndex(ACol, ARow, DayIndex, MonthIndex); @@ -1019,16 +1014,18 @@ begin DS := FYearData[DayIndex, MonthIndex].DisplayText; if DS = '' then Exit; -// Month := ARow; -// Day := StrToInt(FYearData[ACol, ARow].DisplayText); + ADate := EncodeDate(Year, MonthIndex, FYearData[DayIndex, MonthIndex].DayInMonth); + InfoText := FYearData[DayIndex, MonthIndex].InfoText; if FYearData[DayIndex, MonthIndex].Custom then InfoColor := FYearData[DayIndex, MonthIndex].CustomColor else InfoColor := FYearData[DayIndex, MonthIndex].DefaultColor; + if Assigned(FOnSelectDate) then FOnSelectDate(Self, ADate, InfoText, InfoColor); + Result := True; end;