E2034 提供正确数量时实际参数太多

E2034 Too many actual parameters when the correct number is provided

我有一个用于显示某些 UI 元素的程序,但出现了此错误。据我所知,当存在同名过程但我无法识别它时,可能会发生此错误。

我该怎么做才能解决这个问题?

procedure CashAcceptorFormTwoButtonsSplitFiveButtons(Titlu1:string; Titlu2:String;
    InfoText1, InfoText2, InfoText3:string;
    Buton1Visible:boolean; Buton1activ:boolean; Buton1titlu:string; Buton1Detaliu:string; Buton1Color:TColor;
    Buton2Visible:boolean; Buton2activ:boolean; Buton2titlu:string; Buton2Detaliu:string; Buton2Color:TColor;
    Buton3Visible:boolean; Buton3activ:boolean; Buton3titlu:string; Buton3Detaliu:string; Buton3Color:TColor;
    Buton4Visible:boolean; Buton4activ:boolean; Buton4titlu:string; Buton4Detaliu:string; Buton4Color:TColor;
    Buton5Visible:boolean; Buton5activ:boolean; Buton5titlu:string; Buton5Detaliu:string; Buton5Color:TColor;
    Buton6Visible:boolean; Buton6activ:boolean; Buton6titlu:string; Buton6Detaliu:string; Buton6Color:TColor;
    Buton7Visible:boolean; Buton7activ:boolean; Buton7titlu:string; Buton7Detaliu:string; Buton7Color:TColor
    );
    

CashAcceptorFormTwoButtonsSplitFiveButtons(
         '1. ' + IfThen(CashAcceptorCashActive,'Test text0 ', IfThen(CashEnabled,'Test text 2, ','')) + 'Test text 3',
         '2. ' + ifthen(StareStatie=1, 'Test text 4', 'Test text 5'),
         'Test text 6',
         IfThen(CodBare<>'','Test text 7' ,CurrToStr(CashAcceptorTotalCash[0]+CashAcceptorTotalVoucher[0]+CashAcceptorTotalPOS[0]+CashAcceptorTotalCartelaClienti[0])+' Test text 8'),
         CashAcceptorCIF[0],
         FrmMain.EquipNo > 0,
         active and (StareStatie=1) and (CashAcceptorPompaStateAccepting[1] or (CashAcceptorBonSecventa[1] > 0)),
         CashAcceptorPumpName[1],
         CashAcceptorPumpStateText(active, 1),
         CashAcceptorDecodePrescriereColor(1), //10
         FrmMain.EquipNo > 1,
         active and (StareStatie=1) and (CashAcceptorPompaStateAccepting[2] or (CashAcceptorBonSecventa[2] > 0)),
         CashAcceptorPumpName[2],
         CashAcceptorPumpStateText(active, 2),
         CashAcceptorDecodePrescriereColor(2),
         FrmMain.EquipNo > 2,
         active and (StareStatie=1) and (CashAcceptorPompaStateAccepting[3] or (CashAcceptorBonSecventa[3] > 0)),
         CashAcceptorPumpName[3],
         CashAcceptorPumpStateText(active, 3),
         CashAcceptorDecodePrescriereColor(3),
         FrmMain.EquipNo > 3,
         active and (StareStatie=1) and (CashAcceptorPompaStateAccepting[4] or (CashAcceptorBonSecventa[4] > 0)),
         CashAcceptorPumpName[4],
         CashAcceptorPumpStateText(active, 4),
         CashAcceptorDecodePrescriereColor(4),
         FrmMain.EquipNo > 4,
         active and (StareStatie=1) and (CashAcceptorPompaStateAccepting[5] or (CashAcceptorBonSecventa[5] > 0)),
         CashAcceptorPumpName[5],
         CashAcceptorPumpStateText(active, 5),
         CashAcceptorDecodePrescriereColor(5),
         POSEnabled,
         active and (StareStatie=1) and CashAcceptorPOSActive and (codbare = ''),
         'Test text 9',
         'Test text 10',
         clBtnFace,
         true,
         active and (StareStatie=1) and (codbare = ''),
         'Test text 11',
         'Test text 12',
         clBtnFace,
         );

如果在调用方的参数列表末尾有一个额外的逗号,它将产生该错误消息。例如,如果您尝试调用:

procedure Sleep(milliseconds: Cardinal); stdcall;

与:

  Sleep(10,);

编译时会报错:

[dcc32 Error] Unit1.pas(28): E2034 Too many actual parameters

我用 Delphi 10.4.1 检查了你的代码,添加了你没有在你的问题中显示的声明。如果你在你调用 CashAcceptorFormTwoButtonsSplitFiveButtons.

的结束 ) 之前删除额外的 ,,它编译得很好