英文:
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->AddFunction(_D("void ChangeReportField(String fieldstr, String otherfieldstr)"));
In the FastReports code tab using C++Script
, I have:
void MasterData1OnBeforePrint(TfrxComponent Sender)
{
ChangeReportField(<frxDBDataset1."Field1">, <frxDBDataset1."Field2">);
}
I also have the OnUserFunction
event of the TfrxReport
component configured:
Variant __fastcall TMainForm::frxReport1UserFunction(const UnicodeString MethodName, Variant &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->AddFunction(_D("procedure ChangeReportField(fieldstr, otherfieldstr:String)"));
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论