From the following script code, I call the Run procedure from Delphi which calls the showmodal procedure which is also in Delphi. The global variable sl is not instantiated when calling Button1Click() from the newly created modal dialog.

The Script Code.

var sl : TStringList;

procedure Run();
begin
  sl := TStringList.create();
  ShowModal;
  showMessage(sl.Text);
  sl.free;
end;

procedure Button1Click();
begin
  sl.Add('DWS');
end;

The Delphi side code.

1) Call Run()

FExec := FCompiledScript.BeginNewExecution;
FExec.Info.Func['Run'].Call([]);
FExec.EndProgram;

2) Showmodal Eval

Form1 := TForm1.Create(nil);
Form1.Exec := FExec;
Form1.ShowModal;

3) Calling Button1Click from the modal dialog using the same IdwsProgramExecution object

FExec.Info.Func['Button1Click'].Call([]);

At this point I get the error "Object not instantiated". After closing the dialog I get the showmessage with nothing in it.

有帮助吗?

解决方案

This has been fixed by the DWS crew. Issue reported and fixed in a matter of hours. Awesome.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top