Object: IMetabaseObjectDescriptor;
Object: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;
The Object property determines object which will be used to process events.
Event handlers can be the following Fore objects only:
Assembly.
Unit.
Form.
The property is relevant, if the ISharedEventHandler.Enabled property is set to True.
Executing the example requires that the repository contains a unit with the EXPRESS_EVENTS identifier, which will be a handler of the express report events. The unit contains the EventsClass specific class, which description is given on the Event Handling page.
Add links to the Fore, Metabase system assemblies.
Sub UserPRoc;
Var
MB: IMetabase;
SParams: ISharedParams;
ShPar: IMetabaseObjectDescriptor;
EventHandlers: ISharedEventHandlers;
EventHandler: ISharedEventHandler;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get global variables area
ShPar := MB.SpecialObject(MetabaseSpecialObject.SharedParams);
// Get repository parameters
SParams := Shpar.Edit As ISharedParams;
// Get object to work with reports event handler
EventHandlers := SParams.EventHandlers;
// Use reports event handler
EventHandlers.Enabled := True;
// Get and activate express reports event handler
EventHandler := EventHandlers.EventHandler(SharedEventHandlerType.ExpressReport);
EventHandler.Enabled := True;
// Connect unit to handle events
EventHandler.Object := MB.ItemById("EXPRESS_EVENTS");
// Set unit class
EventHandler.EventsClass := "EVENTSCLASS";
// Save changes
(SParams As ImetabaseObject).Save;
End Sub UserPRoc;
After executing the example, the event handler is set for express reports.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.KeFore;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
SParams: ISharedParams;
ShPar: IMetabaseObjectDescriptor;
EventHandlers: ISharedEventHandlers;
EventHandler: ISharedEventHandler;
Begin
// Get repository
MB := Params.Metabase;
// Get global variables area
ShPar := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams];
// Get repository parameters
SParams := Shpar.Edit() As ISharedParams;
// Get object to work with reports event handler
EventHandlers := SParams.EventHandlers;
// Use reports event handler
EventHandlers.Enabled := True;
// Get and activate express reports event handler
EventHandler := EventHandlers.EventHandler[SharedEventHandlerType.sehtExpressReport];
EventHandler.Enabled := True;
// Connect unit to handle events
EventHandler.Object := MB.ItemById["EXPRESS_EVENTS"];
// Set unit class
EventHandler.EventsClass := "EVENTSCLASS";
// Save changes
(SParams As ImetabaseObject).Save();
End Sub;
See also: