Text: String;
The Text property determines a unit text.
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 unit";
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 the example a new unit is created within the Assembly_1 assembly. A template for the Main procedure is contained in the unit text.
See also: