Help - Search - Members - Calendar
Full Version: Internal FastReport error
Fast Reports forum > Fast Reports Products > FastReport 4.0
jonc
Wondering if I can get some help with an error that has been haunting my application. The error occurs for my end users and I can't seem to reproduce or track it down. The exception report I get displays the error inside of FastReports but I'm doing some pretty crazy 'ReportGetValue' lookups so I'm sure it's something I'm doing.

Can someone from FastReports give me a hint as to what is happening at line 1508 in frxPreviewPages.pas?

CODE
List index out of bounds (5).
Exception stack
[004254D5]{ORGdesign.exe} Classes.TList.Get
[00601964]{ORGdesign.exe} frxPreviewPages.TfrxPreviewPages.DrawPage (Line 1508, "frxPreviewPages.pas" + 1)


I'm assuming it's a lookup that doesn't exist. Is it in the ReportGetValue area or something else?

Thanks for any help!
Troy


gpi
What build of FR do you use?
jonc
Sorry for the delay. That was from version 4.11.8.

Thanks,
Troy
gpi
Attach small demo project with problem here
jonc
I can't actually reproduce the problem myself to create a demo. My users have been seeing the problem. I was hoping someone with access to the source could see what is happening around line 1508 in frxPreviewPages.pas. Do you think I'd need to submit a support request?

Thanks,
Troy
gpi
Line 1508 is

CODE
      r := Rect(Round(AbsLeft * ScaleX) - 20, Round(AbsTop * ScaleY) - 20,
                Round((AbsLeft + Width) * ScaleX + 20),
                Round((AbsTop + Height) * ScaleY + 20));


full code:

CODE
procedure TfrxPreviewPages.DrawPage(Index: Integer; Canvas: TCanvas;
  ScaleX, ScaleY, OffsetX, OffsetY: Extended);
var
  i: Integer;
  Page: TfrxReportPage;
  l: TList;
  c: TfrxComponent;
  IsPrinting: Boolean;
  SaveLeftMargin, SaveRightMargin: Extended;
  rgn: HRGN;

  function ViewVisible(c: TfrxComponent): Boolean;
  var
    r: TRect;
  begin
    with c do
      r := Rect(Round(AbsLeft * ScaleX) - 20, Round(AbsTop * ScaleY) - 20,
                Round((AbsLeft + Width) * ScaleX + 20),
                Round((AbsTop + Height) * ScaleY + 20));
    OffsetRect(r, Round(OffsetX), Round(OffsetY));
    Result := RectVisible(Canvas.Handle, r) or (Canvas is TMetafileCanvas);
  end;

begin
  Page := GetPage(Index);
  if Page = nil then Exit;

  SaveLeftMargin := Page.LeftMargin;
  SaveRightMargin := Page.RightMargin;
  if Page.MirrorMargins and (Index mod 2 = 1) then
  begin
    Page.LeftMargin := SaveRightMargin;
    Page.RightMargin := SaveLeftMargin;
  end;

  IsPrinting := Canvas is TfrxPrinterCanvas;
  rgn := 0;
  if not IsPrinting then
  begin
    rgn := CreateRectRgn(0, 0, 10000, 10000);
    GetClipRgn(Canvas.Handle, rgn);
    IntersectClipRect(Canvas.Handle,
      Round(OffsetX),
      Round(OffsetY),
      Round(OffsetX + Page.PaperWidth * fr01cm * ScaleX) - 1,
      Round(OffsetY + Page.PaperHeight * fr01cm * ScaleY) - 1);
  end;

  Page.IsPrinting := IsPrinting;
  Page.Draw(Canvas, ScaleX, ScaleY, OffsetX, OffsetY);
  OffsetX := OffsetX + Page.LeftMargin * fr01cm * ScaleX;
  OffsetY := OffsetY + Page.TopMargin * fr01cm * ScaleY;

  l := Page.AllObjects;

  for i := 0 to l.Count - 1 do
  begin
    c := l[i];
    if (c is TfrxView) and ViewVisible(c) then
      if not IsPrinting or TfrxView(c).Printable then
      begin
        c.IsPrinting := IsPrinting;
        { needed for TOTALPAGES macro }
        if c is TfrxCustomMemoView then
        begin
          THackMemoView(c).FTotalPages := Count;
          THackMemoView(c).FCopyNo := FCopyNo;
          THackMemoView(c).FPrintScale := FPrintScale;
        end;
        { draw the object }
        TfrxView(c).Draw(Canvas, ScaleX, ScaleY, OffsetX, OffsetY);
        c.IsPrinting := False;
      end;
  end;

  Page.LeftMargin := SaveLeftMargin;
  Page.RightMargin := SaveRightMargin;
  if not IsPrinting then
  begin
    SelectClipRgn(Canvas.Handle, rgn);
    DeleteObject(rgn);
  end
end;
jonc
Awesome! Thanks for the reply. Unfortunately I don't think this gets me much closer to solving my problem. The only TList reference I see is "c := l[i];" and I'm guessing our versions are off somehow. I'm suspecting that may be correct though and for some reason a TfrxComponent is expected on the page that doesn't exist.

Thanks,
Troy
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.