AddEventHandler(Events: IPivotEvents): Integer;
Events. Table event handler class.
The AddEventHandler method determines a table event handler.
Table event handler is used only within the session and is not saved together with the report. The method results in the unique handler index that can be used in the RemoveEventHandler method to disable the event handler.
Executing the example requires the following in the repository:
A form that contains the following components:
EaxDocumentViewerBox named EaxDocumentViewerBox1.
UiErAnalyzer named UiErAnalyzer1 which is used as data source for EaxDocumentViewerBox1.
An express report that is a data source for UiErAnalyzer1. The report contains a table.
The handler is connected on opening the form. The handler is removed on closing the form.
Add links to the Dimensions, Express, Pivot system assemblies.
// Event handler
Public Class Pivot_Events: PivotEvents
// Event that occurs on editing dimension selection contents
Public Sub OnSelectionContentChange(Value: IDimInstance);
Begin
WinApplication.InformationBox("The OnSelectionContentChange event occurs for " + Value.Ident);
End Sub OnSelectionContentChange;
End Class Pivot_Events;
Class EVENTHANDLERForm: Form
UiErAnalyzer1: UiErAnalyzer;
EaxDocumentViewerBox1: EaxDocumentViewerBox;
Pvt: IPivot;
Cookie: Integer;
// Open form
Sub EVENTHANDLERFormOnShow(Sender: Object; Args: IEventArgs);
Var
Express: IEaxAnalyzer;
Events: Pivot_Events;
Begin
// Get express report
Express := UiErAnalyzer1.ErAnalyzer;
// Get settings for displaying report data table
Pvt := Express.Pivot;
// Allow event generation
Pvt.EventsEnabled := True;
// Create an class instance for event handling
Events := New Pivot_Events.Create;
// Connect table event handler
Cookie := Pvt.AddEventHandler(Events);
End Sub EVENTHANDLERFormOnShow;
// Close form
Sub EVENTHANDLERFormOnClose(Sender: Object; Args: IEventArgs);
Begin
// Remove event handler
Pvt.RemoveEventHandler(Cookie);
End Sub EVENTHANDLERFormOnClose;
End Class EVENTHANDLERForm;
After starting the form rename the dimension element displayed in the table heading or sidehead. After the event is triggered, the development environment console displays identifier of the dimension, which element was renamed.
See also: