我的问题如下。
下面是我的设置:
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代码之间来回传递对象,但我开始认为做这类事情可能是有限制的。
尝试传递字符串数组而不是TStringList是否更有意义?
发布于 2010-02-09 06:42:35
如果要我猜的话,我会说这可能是因为您还没有注册TStringList类。类必须先在PascalScript中注册,然后才能使用。
https://stackoverflow.com/questions/2225287
复制相似问题