How to trap "Send Email" button in preview

Hi,

Is there a way to trap the Send Email button in the Preview window of FR5? Can it be done in FR6?

I am using Delphi 10.2.

Thank you,

Dave

Comments

  • gpigpi
    edited 7:58AM
    Sample for PDF button:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, frxClass, frxExportPDF, frxPreview, frxDsgnIntf, Menus;
    
    type
      TForm1 = class(TForm)
        frxReport1: TfrxReport;
        frxPDFExport1: TfrxPDFExport;
        SaveDialog1: TSaveDialog;
        procedure FormCreate(Sender: TObject);
        procedure frxReport1Preview(Sender: TObject);
        procedure PDFExport(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    
    {$R *.dfm}
    
    procedure TForm1.PDFExport(Sender: TObject);
    begin
         if SaveDialog1.Execute then
           begin
             frxPDFExport1.FileName:=SaveDialog1.FileName;
             TfrxPreview(frxReport1.Preview).Export(frxPDFExport1);
           end;
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
         frxReport1.ShowReport;
    end;
    
    procedure TForm1.frxReport1Preview(Sender: TObject);
    var i, j, mi: integer;
    begin
           TfrxPreviewForm(frxReport1.PreviewForm).PdfB.OnClick:=PDFExport;
           for i := 0 to frxExportFilters.Count - 1 do
             begin
               if TfrxCustomExportFilter(frxExportFilters[i].Filter).ClassName = 'TfrxPDFExport' then
                 mi:=i;
             end;
           TfrxPreviewForm(frxReport1.PreviewForm).ExportPopup.Items[mi + 2].OnClick:=PDFExport;
           for i:=0 to TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items.Count-1 do
             begin
               if TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].Caption=TfrxPreviewForm(frxReport1.PreviewForm).SaveB.Hint then
                 begin
                   for j:=0 to TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].Count-1 do
                     if TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i][j].Caption=TfrxPreviewForm(frxReport1.PreviewForm).ExportPopup.Items[mi + 2].Caption then
                        TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i][j].OnClick:=PDFExport;
                 end;
               if TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].Caption=TfrxPreviewForm(frxReport1.PreviewForm).PdfB.Hint then
                 TfrxPreviewForm(frxReport1.PreviewForm).RightMenu.Items[i].OnClick:=PDFExport;
             end;
    end;
    
    end.
    
  • edited July 2018
    Thanks for the reply.

    So there is no way to trap the buttons unless we write our own preview. Correct?

    Dave
  • gpigpi
    edited 7:58AM
    wrote:
    Correct?
    No. See my code
  • edited 7:58AM
    Sorry, brain fart on my part. Go it!

    TfrxPreviewForm(frxReport.PreviewForm).EmailB.OnClick:=MyEMailAction;

    Thank you for your help!

    Dave

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.