我的问题如下。
以下是我的设置:
interface
uses windows, {...,} uPSComponent_Default, uPSComponent, uPSRuntime, uPSComponent_Controls;
TForm1 = class(TForm)
//...
PSScript1: TPSScript;
PSImport_Classes1: TPSImport_Classes;
PSImport_Controls1: TPSImport_Controls;
procedure PSScript1Compile(Sender: TPSScript);
//...
Private
procedure NewItem(const Caption:string; const SubItems:TStringList);
//...
end;
implementation
{...}
procedure TForm1.PSScript1Compile(Sender: TPSScript);
begin
//...
Sender.AddMethod(Self, @TForm1.NewItem, 'procedure NewItem(const Caption:string; const SubItems:TStringList);');
//...
end;
为什么我在编译任何脚本时会出现以下错误。
[Error] (1:1): Unable to register function procedure NewItem(const Caption:string; const SubItems:TStringList);
我知道这与我试图将NewItem方法导入PS编译器有关,但我不知道为什么它不接受TStringList。我知道这是TStringList,因为如果我取出TStringList参数,只使用带有以下签名的方法,那么一切都会工作。
procedure NewItem(const Caption:string);
我找不到任何说明我不能在编译器/脚本和我的Delphi代码之间来回传递对象的引用,但我开始认为,完全执行这种类型的操作可能有局限性。