2
votes

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.

1
Could you post the full code to your form and your script, or at least a full, compilable example that will exhibit this behavior? Everything I see looks like it should work, but if I had actual code to run I could test it and see what's going on.Mason Wheeler

1 Answers

1
votes

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