Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TDateEditComboBox: Row index out of bounds
Thu, Jan 28 2016 6:59 AMPermanent Link

Malcolm Taylor

I just noticed that with V2.04 b1 I am getting the following error when
I use the Calendar to select day 31 in the month of January 2016.

   Error: Row index 5 out of bounds
   Line: 1

Naturally I assumed I had made some mistake .. but I think that must
come from 'inside' the component.
Can anyone confirm .. or suggest where I may be going wrong?

Malcolm
Thu, Jan 28 2016 7:35 AMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Hi Malcolm,

I can confirm this also.

Regards,
Hüseyin

Den 28-01-2016 kl. 12:59 skrev Malcolm:
> I just noticed that with V2.04 b1 I am getting the following error when
> I use the Calendar to select day 31 in the month of January 2016.
>
>    Error: Row index 5 out of bounds
>    Line: 1
>
> Naturally I assumed I had made some mistake .. but I think that must
> come from 'inside' the component.
> Can anyone confirm .. or suggest where I may be going wrong?
>
> Malcolm
Thu, Jan 28 2016 7:52 AMPermanent Link

Malcolm Taylor

Hüseyin Aliz wrote:

> Hi Malcolm,
>
> I can confirm this also.
>

Thanks Hüseyin, it looks like one for Tim.
Thu, Jan 28 2016 10:52 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Malcolm,

<< I just noticed that with V2.04 b1 I am getting the following error when I use the Calendar to select day 31 in the month of January 2016. >>

Yeah, it's a bug.  Here's the hot fix:

WebCals unit:

procedure TCalendarControl.UpdateMonthView;
var
  I: Integer;
  TempCell: TCalendarCell;
  TempDay: Integer;
  TempMonthDays: array of Integer;
  TempDate: DateTime;
  TempDays: Integer;
begin
  FYearMonthBar.SelectButton.UpdateCaption(FormatSettings.LongMonthNames[FPeriodMonth]+COMMA+SPACE+
                                           IntToStr(FPeriodYear));
  if IsLeapYear(FPeriodYear) then
     TempMonthDays:=[31,29,31,30,31,30,31,31,30,31,30,31]
  else
     TempMonthDays:=[31,28,31,30,31,30,31,31,30,31,30,31];
  TempDate:=EncodeDate(FPeriodYear,FPeriodMonth,1);
  FPeriodOffset:=WeekDayOf(TempDate);
  if (FPeriodOffset=7) then
     FPeriodOffset:=0;
  for I:=0 to FPeriodOffset-1 do
     begin
     TempCell:=CalendarCells[I];
     TempCell.UpdateCaption('');
     end;
  TempDay:=TempMonthDays[FPeriodMonth-1];
  for I:=0 to TempDay-1 do
     begin
     TempCell:=CalendarCells[FPeriodOffset+I];
     TempCell.UpdateCaption(IntToStr(I+1));
     end;
>>>>>>>>>>  From here
  if (((FPeriodOffset+TempDay) mod FColumnCount) > 0) then
     FPeriodRowCount:=(((FPeriodOffset+TempDay) div FColumnCount)+1)
  else
     FPeriodRowCount:=((FPeriodOffset+TempDay) div FColumnCount);
>>>>>>>>>>  To here
  for I:=(FPeriodOffset+TempDay) to FCalendarCellCount-1 do
     begin
     TempCell:=CalendarCells[I];
     TempCell.UpdateCaption('');
     end;
end;

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jan 28 2016 1:16 PMPermanent Link

Malcolm Taylor

Tim Young [Elevate Software] wrote:

> Yeah, it's a bug.  Here's the hot fix:

Yup, that fixes it, thanks.
(You seem to have declared TempDays, not used it and forgotten to zap
it from that post)
Fri, Jan 29 2016 10:43 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Malcolm,

<< You seem to have declared TempDays, not used it and forgotten to zap it from that post >>

Yeah, the compiler already told me, and I removed it from the actual source. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Image