UseSharedEventHandler: Boolean;
UseSharedEventHandler: boolean;
The UseSharedEventHandler property determines whether express report uses event handler.
Available Values:
True. Default. Express report uses event handler.
False. Express report does not use event handler.
Fore.NET objects must not be used as event handlers.
Executing the example requires that the repository contains an express report with the EXPRESS_EVENTHANDLER identifier.
The repository must also contain an event handler unit with the EXPRESSREPEVENTS identifier that contains the ExpressEvents class used to implement events. The class description is given in the example for IEaxAnalyzerUserEvents.OnAfterExecuteAnalyzer.
Add links to the Express, Fore, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Analyzer: IEaxAnalyzer;
Options: IEaxAnalyzerOptions;
SParams: ISharedParams;
ShPar: IMetabaseObjectDescriptor;
EventHandlers: ISharedEventHandlers;
EventHandler: ISharedEventHandler;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get global variable area
ShPar := MB.SpecialObject(MetabaseSpecialObject.SharedParams);
// Get repository parameters
SParams := Shpar.Edit As ISharedParams;
// Get object used to work with report event handler
EventHandlers := SParams.EventHandlers;
// Use the report event handler
EventHandlers.Enabled := True;
// Get and activate the express report event handler
EventHandler := EventHandlers.EventHandler(SharedEventHandlerType.ExpressReport);
EventHandler.Enabled := True;
// Connect the event handler
EventHandler.Object := MB.ItemById("EXPRESSREPEVENTS");
// Set module class
EventHandler.EventsClass := "ExpressRep_Events";
// Save changes in repository parameters
(SParams As ImetabaseObject).Save;
// Get express report
Analyzer := MB.ItemById("EXPRESS_EVENTHANDLER").Edit As IEaxAnalyzer;
// Get report parameters
Options := Analyzer.Options;
// Use the event handler
If Options.UseSharedEventHandler = False Then
Options.UseSharedEventHandler := True;
End If;
// Save changes in express report
(Analyzer As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the express report uses the specified event handler.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.KeFore;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Analyzer: IEaxAnalyzer;
Options: IEaxAnalyzerOptions;
SParams: ISharedParams;
ShPar: IMetabaseObjectDescriptor;
EventHandlers: ISharedEventHandlers;
EventHandler: ISharedEventHandler;
Begin
// Get repository
MB := Params.Metabase;
// Get global variable area
ShPar := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams];
// Get repository parameters
SParams := Shpar.Edit() As ISharedParams;
// Get object used to work with report event handler
EventHandlers := SParams.EventHandlers;
// Use the report event handler
EventHandlers.Enabled := True;
// Get and activate the express report event handler
EventHandler := EventHandlers.EventHandler[SharedEventHandlerType.sehtExpressReport];
EventHandler.Enabled := True;
// Connect the event handler
EventHandler.Object := MB.ItemById["EXPRESSREPEVENTS"];
// Set module class
EventHandler.EventsClass := "ExpressRep_Events";
// Save changes in repository parameters
(SParams As ImetabaseObject).Save();
// Get express report
Analyzer := MB.ItemById["EXPRESS_EVENTHANDLER"].Edit() As IEaxAnalyzer;
// Get report parameters
Options := Analyzer.Options;
// Use the event handler
If Options.UseSharedEventHandler = False Then
Options.UseSharedEventHandler := True;
End If;
// Save changes in express report
(Analyzer As IMetabaseObject).Save();
End Sub;
See also: