Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Tech Tip: Using Template Events

edited March 2002 in General
Re: Tech Tip: Using Template Events

Delphi 6, RB Ent 6.03

I followed EXACTLY the three pieces of code in this tech tip:
1. Declared MyTemplateOnLoadEndEvent ,
2. Assigned it to aReport.Template.OnLoadEnd in the form's OnCreate, and
3. Implemented the method (minimal ShowMessage)

If I don't add the Sender parameter signature to the assignment statement, Delphi reports "Incompatible types; parameter lists differ." If I add the (Sender:
TObject) as a parameter in the assignment, then it reports "Incompatible types: TppStreamEvent and procedure, untyped pointer, or untyped parameter." The Tech
Tip does not include the parameter in the assignment statement.

Has something changed since this Tech Tip was written?

Dennis McFall

Comments

  • edited March 2002
    I was able to compile your example without a problem. Take a look at your
    declaration and make sure that the procedure prototype is correct,
    ie. procedure myTemplateOnLoadEndEvent(Sender: TObject);
    Below is the minimal class implementation.

    ----------------------------------------------------------------------------
    ---------------
    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, ppComm, ppRelatv, ppProd, ppClass, ppReport;

    type
    TForm1 = class(TForm)
    ppReport1: TppReport;
    procedure FormCreate(Sender: TObject);
    private
    procedure myTemplateOnLoadEndEvent(Sender: TObject);
    public
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    ppReport1.Template.OnLoadEnd := myTemplateOnLoadEndEvent;
    end;

    procedure TForm1.myTemplateOnLoadEndEvent(Sender: TObject);
    begin
    ShowMessage('Template OnLoadEnd Event');
    end;

    end.
    ----------------------------------------------------------------------------
    ---------------

    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.