The Event Handling Tab

To work with event handlers, go to the Event Handling tab of the Report Units and Event Handling dialog box:

In the Unit drop-down list select an object that contains class for handling regular report events. The list contains all objects added on the Units tab. The selected object must contain description of a class inherited from the ReportEvents class that contains implementation of the methods that are used to handle regular report events. If a .NET assembly is used as an event handler, the class must be inherited from the PrxForeNetReportUserEventsClass class. Specify class name in the Class box.

Event handler class description can be created automatically. To create a new unit or .NET assembly, click the Create button and select the required handler type. A class that contains templates of event handlers for all report events is created in the specified repository folder.

Event handler class can have the designer called at each class initialization. The designer must not contain parameters. If the class has several designers without parameters, the first designer is called (located above the others in the code). If the designer is used to handle .NET assembly events, it should be claimed with the Public access modifier.

NOTE. Event class is initialized each time when an action is executed in the report. In this case wither one event or a chain of events can be generated.

Example of Event Handler

To show an information message that contains specific data each time after the regular report data area is calculated, create a unit in the Object Navigator window. Add links to the Report and Ui assemblies:

Class EventsClass: ReportEvents
    //Designer opened at initialization of the EventsClass class
    Constructor Create;
    Begin
        //Initialization of objects
    End Constructor Create;
    //Event that takes place after data area of a regular report has been calculated
    Public Sub OnAfterExecuteDataIsland(DataIsland: IPrxDataIsland);
    Begin
        WinApplication.InformationBox("Data area has been calculated: " + DataIsland.Id);
    End Sub OnAfterExecuteDataIsland;
End Class EventsClass;

The corresponding Fore.NET handler looks as follows:

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Ui;

Public Class EventsClass: PrxForeNetReportUserEventsClass
    //Designer opened at initialization of the EventsClass class
    Public Constructor Create();
    Begin
        //Initialization of objects
    End Constructor Create;
    //Event that takes place after data area of a regular report has been calculated
    Public Override Sub OnAfterExecuteDataIsland(DataIsland: IPrxDataIsland);
    Var
        WinAppCls: WinApplicationClass = New WinApplicationClassClass();
    Begin
        WinAppCls.InformationBox("A data area has been calculated: " + DataIsland.Id, Null);
    End Sub OnAfterExecuteDataIsland;
End Class EventsClass;

The occurred event shows an information message containing the identifier of the calculated data area.

See also:

Event Handling in Reports