从下面的脚本代码中,我从Delphi调用Run程序,该程序调用也在Delphi中的showmodal过程。 从新创建的模式对话框调用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)使用相同的IdwsProgramExecution对象从模式对话框调用Button1Click
FExec.Info.Func['Button1Click'].Call([]);
此时我收到错误“Object not instantiated”。在关闭对话框后,我得到了没有任何内容的showmessage。
答案 0 :(得分:1)
这已由DWS工作人员修复。问题报告并在几小时内修复。真棒。