IPrxReport.RemoveEventHandler

Syntax

RemoveEventHandler(Cookie: Integer);

Parameters

Cookie - index of event handler.

Description

The RemoveEventHandler method removes event handler from the report.

Example

To execute the following example, create a unit (the text is given below), then create a regular report and specify the earlier created unit as event handler for this report (specify the EventsClass class). Create the following two hyperlinks in the report: the first one executes the AddEventHandler procedure the second one executes the RemoveEventHandler procedure.

Var i: Integer;
Class EventsClass: ReportEvents
    //event after report export
    Public Sub OnAfterExportReport(Report: IPrxReport);
    Begin
        WinApplication.InformationBox("Report  export  «" + Report.Name + "» complete");
    End Sub OnAfterExportReport;
End Class EventsClass;

Class MyEventsClass: ReportEvents
    //event before  saving report
    Public Sub OnBeforeSaveReport(Report: IPrxReport; Var Cancel: Boolean);
    Begin
        If Not WinApplication.ConfirmationBox("Save  data?"Then
        Cancel := True;
        End If;
End Sub OnBeforeSaveReport;
End Class MyEventsClass;

Public Sub AddEventHandler;
Var
    Ev: MyEventsClass;
Begin
    Ev := New MyEventsClass.Create;
    i := PrxReport.ActiveReport.AddEventHandler((Ev As IPrxReportUserEvents));
End Sub AddEventHandler;

Public Sub RemoveEventHandler;
Begin
    PrxReport.ActiveReport.RemoveEventHandler(i);
End Sub RemoveEventHandler;

After clicking the hyperlink that executes the AddEventHandler procedure, the report will use the MyEventsClass handler. To check them, change the report, save changes and export. After clicking the hyperlink that executes the RemoveEventHandler procedure the previously added event handler is deleted.

See also:

IPrxReport