Delphi Compiler Error
E2138 Invalid message parameter list
Reason for the Error & Solution
A message procedure can take only one, VAR, parameter; it’s type is not checked.
program Produce; type Base = class procedure Msg1(x : Integer); message 151; procedure Msg2(VAR x, y : Integer); message 152; end; procedure Base.Msg1(x : Integer); begin end; procedure Base.Msg2(VAR x, y : Integer); begin end; begin end.
The obvious error in the first case is that the parameter is not VAR. The error in the second case is that more than one parameter is declared.
program Solve; type Base = class procedure Msg1(VAR x : Integer); message 151; procedure Msg2(VAR y : Integer); message 152; end; procedure Base.Msg1(VAR x : Integer); begin end; procedure Base.Msg2(VAR y : Integer); begin end; begin end.
The solution in both cases was to only specify one, VAR, parameter in the message method declaration.