E2064 Left side cannot be assigned to

152 views
Skip to first unread message

murphy

unread,
Sep 28, 2015, 10:30:10 AM9/28/15
to
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

unread,
Sep 28, 2015, 6:01:31 PM9/28/15
to
In article <mubhj4$hgj$1...@ls237.t-com.hr>, murph...@gmail.com says...
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

Reply all
Reply to author
Forward
0 new messages