jvcllaz: Minor refactoring of JvYearGrid

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8485 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-17 17:28:20 +00:00
parent 29f6add780
commit d026204c55

View File

@ -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;