Discussion:
E2064 Left side cannot be assigned to
(too old to reply)
murphy
2015-09-28 14:07:33 UTC
Permalink
In Delphi 2009 this code works fine.
In Delphi 10 Seattle produce error:
[dcc32 Error] ...: E2064 Left side cannot be assigned to
How to customize the code to Delphi 2010?


type TParam = record
Tim : Integer;
URL: string;
Por : Integer;
Act : string;
end;

private
fMyParam : TParam;
procedure SetMyParam(const Value: TParam);

published
property MyParam: TParam read fMyParam write SetMyParam;

procedure SetMyParam(const Value: TParam);
begin
fMyParam := Value;
end;

procedure Init;
// ***********
// [dcc32 Error] ...: E2064 Left side cannot be assigned to
// ***********
with MyParam do begin
Tim := 100;
URL := 'http://test.com';
Por := 21;
Act := 'open';
end;
end;
M Philbrook
2015-09-28 22:07:43 UTC
Permalink
Post by murphy
In Delphi 2009 this code works fine.
[dcc32 Error] ...: E2064 Left side cannot be assigned to
How to customize the code to Delphi 2010?
type TParam = record
Tim : Integer;
URL: string;
Por : Integer;
Act : string;
end;
private
fMyParam : TParam;
procedure SetMyParam(const Value: TParam);
published
property MyParam: TParam read fMyParam write SetMyParam;
procedure SetMyParam(const Value: TParam);
begin
fMyParam := Value;
end;
procedure Init;
// ***********
// [dcc32 Error] ...: E2064 Left side cannot be assigned to
// ***********
with MyParam do begin
Tim := 100;
URL := 'http://test.com';
Por := 21;
Act := 'open';
end;
end;
Yes and it makes sense why it's telling you that..

Your class is not giving you a pointer to the internal record, it
expects you to send a complete record to it.

In this example, you are attempting set the members of the record
one at a time, this is not how that style works.

You need to either change the property "Write" to point directly to the
internal class instant or, create a local record, set the values and
then assign that record to the property, where it receives the complete
body at once.

That's my take on it and i am sticking to it.

Jamie

Loading...