Error: Overloaded function in web.pas

After moving to a new PC
and updating Delphi 12.2 to 12.2 Patch 2
and TMS WebCore 2.5.x to 2.6.1.2

I get this error:
[Fehler] Webframe.Statusanzeige.pas(110): Can't determine which overloaded function to call, D:\Programme\TMS\TMS WEB Core RSXE15\Core Source\RTL\web.pas(156,22), D:\Programme\TMS\TMS WEB Core RSXE15\Core Source\RTL\web.pas(155,22)

My call is in this function (document.querySelectorAll):

procedure TsngStatusbar.Clear( AFrame: String);
var
  i: Integer;
  Status: TsngStatusbarStatus;

  procedure RemoveElement( currentValue: TJSNode; currentIndex: NativeInt; list: TJSNodeList);
  begin
    TJSElement( currentValue).remove;
  end;

begin
  document.querySelectorAll( 'span[data-sng-form="'+AFrame+'"]').forEach( @RemoveElement);
  for i := FStatuslist.Count-1 downto 0 do
    if FStatuslist[i].Frame = AFrame then begin
      Status := FStatuslist[i];
      Status.Free;
      FStatuslist.Delete( i);
    end;
end;

The corresponding lines in Web.pas:

  TJSNodeListCallBack = reference to procedure (currentValue : TJSNode; currentIndex: NativeInt; list : TJSNodeList);
  TJSNodeListEvent = procedure (currentValue : TJSNode; currentIndex: NativeInt; list : TJSNodeList) of object;
  
  TJSNodeList = class {$IFDEF PAS2JS} external name 'NodeList'  {$ENDIF}(TJSObject)
  Private
    FLength : NativeInt; external name 'length';
  Public
    procedure forEach(const aCallBack : TJSNodeListCallBack);
    procedure forEach(const aCallBack : TJSNodeListEvent);
    function item(aIndex : NativeInt) : TJSNode;
    Property length : NativeInt Read FLength;
    Property Nodes [aIndex : NativeInt] : TJSNode Read item; default;
  end;

Isn't there a distinction missing here with overload?

Best regards
Thomas

Oh, the line ist "procedure forEach(const ..."

Ok, I can solve it by casting the procedure.
TJSNodeListCallBack( @RemoveElement)

But has anything changed here between 2.5.x and 2.6.1.2?

The only change we did was change

TJSNodeListCallBack = procedure (currentValue : TJSNode; currentIndex: NativeInt; list : TJSNodeList);

to

TJSNodeListCallBack = reference to procedure (currentValue : TJSNode; currentIndex: NativeInt; list : TJSNodeList);

so, the parameter list itself, did not change.
But indeed, a cast always forces the compiler to see the right function.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.