TfrxPreview AccessViolation by using Find Function

edited February 2018 in FastReport VCL 5
Hi,

When you put the TfrxPreview into a vcl container component like a TPanel, some of the Find Functions give you AccessViolations.

A simple test is to put a TfrxPreview onto a TPanel, show the report in runtime, and then call the frxPreview1.Find Method.
Another simple test is to set the frxPreview1.FindFmVisible Property true, and then click in runtime the Find Button in the right shown Element.

I suggest the problem is FastReport referencing the FindForm in a few places in code via eg TfrxPreviewForm(Self.Parent).FindB.Down := False;
This not account the situation the TfrxPreview itself is embedded in a ContainerElement and not in the form itself where I suggest the TfrxPreviewform do its own create.

best regards
Markus

Comments

  • gpigpi
    edited 10:18AM
    Modify frxPreview.pas
    @@ -2152,6 +2152,11 @@ begin
         end;
         Free;
       end;}
    +  if not (Self.Parent is TfrxPreviewForm) then
    +    begin
    +      FindFmVisible := not FindFmVisible;
    +      exit;
    +    end; 
     
       if not TfrxPreviewForm(Self.Parent).FindB.Down then
          TfrxPreviewForm(Self.Parent).FindB.Down := True
    @@ -2588,7 +2593,8 @@ begin
         end
         else
           FWorkSpace.FLastFoundPage := PageNo - 1;
    -    TfrxPreviewForm(Self.Parent).FindB.Down := False;
    +    if Self.Parent is TfrxPreviewForm then
    +      TfrxPreviewForm(Self.Parent).FindB.Down := False;
         FindFmVisible := False;
         Self.SetFocus;
       end;
    

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.