ajst 18 Junior Poster

Hi Guys and girls,

I'm using a TMonthCalander to display Dates, I'm using the BoldDays method to bold the important days.

I have everything working fine when the user changes the month via the TMonthCalander controls.

But I can not bold the days when they click a button.

I've tried calling the GetMonthInfo method manually but it does not bold the days. It is finding the correct days to Bold but does not Bold them. As soon as I change the month on the calendar it starts bolding the correct days again.

Thanks in advance for any help.

// my GetMonthInfo method which is assigned to my TMonthCalander called da
procedure TChangeRepeatBooking.daGetMonthInfo(Sender: TObject; Month: Cardinal;
  var MonthBoldInfo: Cardinal);
var
startDate  : TSysDate;
finishDate : TSysDate;
boldDays   : array[1..31] of cardinal;

begin
startDate := DateTimeToSysDate(StartDatePicker.Date);
finishDate := DateTimeToSysDate(FinishDatePicker.Date);
FillChar(boldDays,sizeof(boldDays),Char(0));


  while TimeDiff(@startDate,@FinishDate) >= 0 do
  begin
    if (CheckDays(DayOfWeek(SysDateToDateTime(startDate)))) and (MonthOf(SysDateToDateTime(startDate)) = Month) then
    begin
      boldDays[DayOfTheMonth(SysDateToDateTime(startDate))] := DayOfTheMonth(SysDateToDateTime(startDate));
    end
    else if (MonthOf(SysDateToDateTime(startDate)) = Month) then
       boldDays[DayOfTheMonth(SysDateToDateTime(startDate))] := 0;

    AddTimeHours(startDate,24);
  end;
  da.BoldDays( boldDays,MonthBoldInfo);
  cardinalMonthBold := MonthBoldInfo;

end;

//when they click a button it calls this method like so
cardinalMonth := MonthOf(da.date);

daGetMonthInfo(self,cardinalMonth,cardinalMonthBold);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.