Y
yanfei0891_firs
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么我的IOTAProjectCreator的NewProjectSource方法中的ProjectName参数总是空值?
程序代码段如下:
TGxProjectCreator = class(TInterfacedObject, IOTACreator, IOTAProjectCreator)
public
// IOTACreator
function GetCreatorType: string;
function GetExisting: Boolean;
function GetFileSystem: string;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;
// IOTAProjectCreator
function GetFileName: string;
function GetOptionFileName: string;
function GetShowSource: Boolean;
procedure NewDefaultModule;
function NewOptionSource(const ProjectName: string): IOTAFile;
procedure NewProjectResource(const Project: IOTAProject);
function NewProjectSource(const ProjectName: string): IOTAFile;
end;
......
......
function TGxProjectCreator.NewProjectSource(const ProjectName: string): IOTAFile;
var sSource : String;
begin
showmessage(ProjectName);
sSource := 'program '+ProjectName+#13#10+
'uses'+#13#10+
'Forms;'+#13#10+
'{$R *.res}'+#13#10+#13#10+
'begin'+#13#10+
'Application.Initialize;'+#13#10+
'Application.Run;'+#13#10+
'end.';
ShowMessage(sSource);
Result := TDemoSourceFile.Create(sSource);
end;
但其中 showmessage(ProjectName); ProjectName总是空值,导致生成application失败
如果用它自己的默认:result =nil;是可以成功生成一个application的。
大家知道这是为什么吗?
程序代码段如下:
TGxProjectCreator = class(TInterfacedObject, IOTACreator, IOTAProjectCreator)
public
// IOTACreator
function GetCreatorType: string;
function GetExisting: Boolean;
function GetFileSystem: string;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;
// IOTAProjectCreator
function GetFileName: string;
function GetOptionFileName: string;
function GetShowSource: Boolean;
procedure NewDefaultModule;
function NewOptionSource(const ProjectName: string): IOTAFile;
procedure NewProjectResource(const Project: IOTAProject);
function NewProjectSource(const ProjectName: string): IOTAFile;
end;
......
......
function TGxProjectCreator.NewProjectSource(const ProjectName: string): IOTAFile;
var sSource : String;
begin
showmessage(ProjectName);
sSource := 'program '+ProjectName+#13#10+
'uses'+#13#10+
'Forms;'+#13#10+
'{$R *.res}'+#13#10+#13#10+
'begin'+#13#10+
'Application.Initialize;'+#13#10+
'Application.Run;'+#13#10+
'end.';
ShowMessage(sSource);
Result := TDemoSourceFile.Create(sSource);
end;
但其中 showmessage(ProjectName); ProjectName总是空值,导致生成application失败
如果用它自己的默认:result =nil;是可以成功生成一个application的。
大家知道这是为什么吗?