Assemblies: IWxAssemblies;
The Assemblies property returns the assembly containing a collection of units.
The collection of units is used to determine an event handler in the workspace.
Executing the example requires that the repository contains a workspace with the WORKSPACE identifier and a unit with the MODULE identifier. The unit should contain a class named EventsClass,= that will be used as an event handler.
Add links to the Metabase and Workspace system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Workspace: IWorkspace;
Assembly: IWxAssemblies;
Info: IMetabaseObjectCreateInfo;
MObj: IMetabaseObjectDescriptor;
Obj: IMetabaseObject;
KeyObj: Integer;
Begin
// Get the current repository
MB := MetabaseClass.Active;
// Get workspace
Workspace := MB.ItemById("WORKSPACE").Edit As IWorkspace;
// Get unit and its key
MObj := MB.ItemById("MODULE");
KeyObj := MObj.Key;
// Get assembly
Assembly := Workspace.Assemblies;
// Add a unit
Assembly.Add(MObj);
Assembly.EventsAssembly := KeyObj;
// Determine a class with event handler
Assembly.EventsClass := "EventsClass";
// Save changes
(Workspace As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the specified event handler is connected in the workspace.
See also: