Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top