|
Implementing the IOTAFile is simple and straightforward.
|
IOTAFile = interface(IUnknown)
['{6E2AD9B0-F7F0-11D1-AB26-00C04FB16FB3}']
function GetSource: string;
function GetAge: TDateTime;
property Source: string read GetSource;
property Age: TDateTime read GetAge;
end; |
|
type
TProjectCreatorFile = class(TInterfacedObject,
IOTAFile)
private
FAge: TDateTime
FModuleIdent,
FFormIdent,
FAncestorIdent: string; //
Passed in from the IOTAModuleCreator
public
constructor Create(const ModuleIdent,
FormIdent, AncestorIdent: string);
function GetSource: string;
function GetAge: TDateTime;
end;
implementation
{ TProjectCreatorFile }
constructor TProjectCreatorFile.Create(const
ModuleIdent, FormIdent, AncestorIdent: string);
begin
FAge := -1; // Flag age
as New File
FModuleIdent := ModuleIdent;
FFormIdent := FormIdent;
FAncestorIdent := AncestorIdent;
end;
function TProjectCreatorFile.GetAge: TDateTime;
begin
Result := FAge;
end;
function TProjectCreatorFile.GetSource: string;
begin
Result := ProjectCode_Using_PassedParams_To_Parameterize;
end; |
Now in the IOTAModuleCreator.NewImplSource method simply
creates an instance of this object.
|
function
TSampleFormCreatorModule.NewImplSource(const ModuleIdent,
FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := TFormCreatorFile.Create(ModuleIdent,
FormIdent, AncestorIdent);
end; |

Now that we have a basic Project with a default Form created
lets add some Components to it. 
|