AddMethod overload problem

edited 8:00AM in FastScript
Hi all,

I am trying to set the column width separately for each column in a crossview by adding a procedure with fast script in Delphi XE6:

function TForm1.CallMethod(Instance: TObject; ClassType: TClass; const MethodName: String; var Param1: Integer; var Param2: Variant; var Param3: Extended): Variant;
begin
Cross1OnCalcWidth(Param1, Param2, Param3);
end;

procedure TForm1.Cross1OnCalcWidth(ColumnIndex: Integer; const ColumnValues: Variant; var Width: Extended);
begin
if ColumnIndex = 6 then
Width:= 200
else if ColumnIndex = 7 then
Width:= 200
else
Width:= 100;
end;

procedure Button1.Click(Sender: TObject);
fsScript1.Clear;
fsScript1.Parent := fsGlobalUnit;
fsScript1.SyntaxType := 'PascalScript';
fsScript1.AddMethod('procedure Cross1OnCalcWidth(ColumnIndex: Integer; ColumnValues: Variant; var Width: Extended)', CallMethod);
if fsScript1.Compile then
begin
fsScript1.Execute
end
else
begin
ShowMessage(fsScript1.ErrorMsg);
end;
end;

I get the following error message: [dcc32 Error] uMain.pas(776): E2250 There is no overloaded version of 'AddMethod' that can be called with these arguments.

In the Fast Script manual the AddMethod are given two parameters, but in Delphi it requires four parameters, the two extra are strings and I have no idea what they should be.

Can anyone help me?

Thanks.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.