从下面的脚本代码中,我从Delphi调用Run过程,该过程调用同样在Delphi中的showmode过程。在新创建的模态对话框中调用Button1Click()时,全局变量sl不会实例化。
脚本代码。
var sl : TStringList;
procedure Run();
begin
sl := TStringList.create();
ShowModal;
showMessage(sl.Text);
sl.free;
end;
procedure Button1Click();
begin
sl.Add('DWS');
end;
Delphi端代码。
1) 调用Run()
FExec := FCompiledScript.BeginNewExecution;
FExec.Info.Func['Run'].Call([]);
FExec.EndProgram;
2) Showmodal Eval
Form1 := TForm1.Create(nil);
Form1.Exec := FExec;
Form1.ShowModal;
3) 调用Button1Click从模式对话框使用相同的IdwsProgramExecution对象
FExec.Info.Func['Button1Click'].Call([]);
在这一点上,我得到了错误"对象未实例化"。关闭对话框后,我得到了一条没有任何内容的showmessage。
DWS工作人员已对此进行了修复。问题在几个小时内报告并解决。令人惊叹的