IPivot.AddEventHandler

Fore Syntax

AddEventHandler(Events: IPivotEvents): Integer;

Fore.NET Syntax

AddEventHandler(Events: Prognoz.Platform.Interop.Pivot.IPivotEvents): integer;

Parameters

Events. Table event handler class.

Description

The AddEventHandler method determines a table event handler.

Comments

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.

Fore Example

Executing the example requires that the repository contains:

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.

Fore.NET Example

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:

IPivot