Text: String;
The Text property determines text of the module.
Executing the example requires that the repository contains an assembly with the Assembly_1 identifier.
Sub Main;
Var
MB: IMetabase;
Assembly: IMetabaseObjectDescriptor;
CrInfo: IMetabaseObjectCreateInfo;
Modul: IModule;
Begin
MB := MetabaseClass.Active;
Assembly := MB.ItemById("Assembly_1");
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_MODULE;
CrInfo.Id := "NewModule";
CrInfo.Name := "New module";
CrInfo.Parent := Assembly;
Modul := MB.CreateObject(CrInfo).Edit As IModule;
Modul.Text :=
"Sub Main;" + #13 + #10 +
"Begin" + #13 + #10 +
"End Sub Main;";
If Modul.Modified Then
(Modul As IMetabaseObject).Save;
End If;
End Sub Main;
After executing this example a new module is created within the Assembly_1 assembly. A template for the Main procedure is contained in the text of a module.
See also: