Internal FastReport error

edited 9:50PM in FastReport 4.0
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?
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


Comments

  • gpigpi
    edited 9:50PM
    What build of FR do you use?
  • edited 9:50PM
    Sorry for the delay. That was from version 4.11.8.

    Thanks,
    Troy
  • gpigpi
    edited 9:50PM
    Attach small demo project with problem here
  • edited 9:50PM
    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
  • gpigpi
    edited November 2011
    Line 1508 is
          r := Rect(Round(AbsLeft * ScaleX) - 20, Round(AbsTop * ScaleY) - 20,
                    Round((AbsLeft + Width) * ScaleX + 20),
                    Round((AbsTop + Height) * ScaleY + 20));
    

    full 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;
    
  • edited 9:50PM
    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;" 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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.