FastReports Pro VCL中的用户函数在使用C++函数时显示”实际参数太多”。

huangapple go评论54阅读模式
英文:

User function for FastReports Pro VCL says "Too Many Actual Parameters" when using a C++ function

问题

我正在尝试设置FastReports Pro以使用用户函数解码字段。

在我的主窗体构造函数中,我设置了:

frxReport1->AddFunction(_D("void ChangeReportField(String fieldstr, String otherfieldstr)"));

在FastReports代码选项卡中使用C++Script,我有以下内容:

void MasterData1OnBeforePrint(TfrxComponent Sender)
{
    ChangeReportField(<frxDBDataset1."Field1">, <frxDBDataset1."Field2">);
}

我还配置了TfrxReport组件的OnUserFunction事件:

Variant __fastcall TMainForm::frxReport1UserFunction(const UnicodeString MethodName, Variant &Params)
{ }

当我尝试运行报告时,我收到以下错误消息:

Too Many Actual Parameters

指向MasterData1OnBeforePrint()中的ChangeReportField(左括号。

我知道这个函数目前不做任何事情,因为它不返回任何值。一旦我真正让它工作(调用用户函数),我会解决这个问题。

我做错了什么?

英文:

I am trying to setup FastReports Pro to decode a field by using a user function.

In my main form constructor, I set:

frxReport1-&gt;AddFunction(_D(&quot;void ChangeReportField(String fieldstr, String otherfieldstr)&quot;));

In the FastReports code tab using C++Script, I have:

void MasterData1OnBeforePrint(TfrxComponent Sender)
{
    ChangeReportField(&lt;frxDBDataset1.&quot;Field1&quot;&gt;, &lt;frxDBDataset1.&quot;Field2&quot;&gt;);                                                                                                   
}

I also have the OnUserFunction event of the TfrxReport component configured:

Variant __fastcall TMainForm::frxReport1UserFunction(const UnicodeString MethodName, Variant &amp;Params)
{ }

When I try to run the report, I get this error message:

> Too Many Actual Parameters

pointing to the left parentheses of the ChangeReportField( in MasterData1OnBeforePrint()

I know this function currently doesn't do anything because it doesn't return a value. I'll get to that once I get it actually working (calling the user function).

What am I doing wrong?

答案1

得分: 2

当作为Pascal函数添加时,它可以工作:

frxReport1->AddFunction(_D("procedure ChangeReportField(fieldstr, otherfieldstr:String)"));
英文:

When added as a Pascal function, it works:

frxReport1-&gt;AddFunction(_D(&quot;procedure ChangeReportField(fieldstr, otherfieldstr:String)&quot;));

huangapple
  • 本文由 发表于 2023年5月25日 07:00:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76327894.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定