AddEventHandler(Events: IPivotEvents): Integer;
AddEventHandler(Events: Prognoz.Platform.Interop.Pivot.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 that is why it is reasonable to use Fore and Fore.NET forms.
Executing the example requires that the repository contains:
A form that contains the following components:
EaxDocumentViewerBox with the EaxDocumentViewerBox1 identifier.
UiErAnalyzer with the UiErAnalyzer1 identifier that is a 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 event handler is removed by means of the IPivot.RemoveEventHandler method on opening the form.
Add links to the Dimensions, Pivot, Ui 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 occurred for " + Value.Ident);
End Sub OnSelectionContentChange;
End Class Pivot_Events;
// Open form
Sub EVENTHANDLERFormOnShow(Sender: Object; Args: IEventArgs);
Var
Express: IEaxAnalyzer;
Pivot: IPivot;
cl: Pivot_Events;
Begin
// Get express report
Express := UiErAnalyzer1.ErAnalyzer;
// Get display settings of report data table
Pivot := Express.Pivot;
// Enable generation of events
Pivot.EventsEnabled := True;
// Create a new class
cl := New Pivot_Events.Create;
// Connect event handler for table
Pivot.AddEventHandler(cl);
End Sub EVENTHANDLERFormOnShow;
// Close form
Sub EVENTHANDLERFormOnClose(Sender: Object; Args: IEventArgs);
Var
Express: IEaxAnalyzer;
Pivot: IPivot;
cl: Pivot_Events;
Begin
// Get express report
Express := UiErAnalyzer1.ErAnalyzer;
// Get display settings of report data table
Pivot := Express.Pivot;
// Enable generation of events
Pivot.EventsEnabled := True;
// Create a new class
cl := New Pivot_Events.Create;
// Connect event handler for table
Pivot.AddEventHandler(cl);
// Remove event handler
Pivot.RemoveEventHandler(Pivot.AddEventHandler(cl));
End Sub EVENTHANDLERFormOnClose;
After starting the form rename the dimension element displayed in the table heading or sidehead. As a result, the information window opens that specifies, with which identifier the event occurred for dimension.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Pivot;
…
// Event handler
Public Class Pivot_Events: IPivotEvents
// Event that occurs on editing dimension selection contents
Public Sub OnSelectionContentChange(Value: IDimInstance);
Begin
MessageBox.Show("The OnSelectionContentChange event occurred for " + Value.Ident);
End Sub OnSelectionContentChange;
// Call other methods for implementing events
…
End Class Pivot_Events;
// Open form
Private Sub EVENTHANDLER_NETForm_Shown(sender: System.Object; e: System.EventArgs);
Var
Express: IEaxAnalyzer;
Pivot: IPivot;
cl: Pivot_Events;
Begin
// Get express report
Express := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
// Get display settings of report data table
Pivot := Express.Pivot;
// Enable generation of events
Pivot.EventsEnabled := True;
// Create a new class
cl := New Pivot_Events.Create();
// Connect event handler for table
Pivot.AddEventHandler(cl);
End Sub;
// Close form
Private Sub EVENTHANDLER_NETForm_FormClosing(sender: System.Object; e: System.Windows.Forms.FormClosingEventArgs);
Var
Express: IEaxAnalyzer;
Pivot: IPivot;
cl: Pivot_Events;
Begin
// Get express report
Express := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
// Get display settings of report data table
Pivot := Express.Pivot;
// Enable generation of events
Pivot.EventsEnabled := True;
// Create a new class
cl := New Pivot_Events.Create();
// Connect event handler for table
Pivot.AddEventHandler(cl);
// Remove event handler
Pivot.RemoveEventHandler(Pivot.AddEventHandler(cl));
End Sub;
See also: