3
votes

I am having trouble using the Inc and Dec procedures in Delphi 2010.

Here's a snippet of my code:

if NOT(frmMain.Height = 0) then
begin
  Dec(frmMain.Height, 2);
  Inc(frmMain.Top);
end;

And I get a:

[DCC Error] frmMain_U.pas(44): E2064 Left side cannot be assigned to

Any ideas? I have a feeling I might be missing something stupid here...

EDIT: Read up on procedures here:

http://www.delphibasics.co.uk/RTL.asp?Name=Inc

http://www.delphibasics.co.uk/RTL.asp?Name=Dec

1
The answer to your question is irrelevant for practical purposes, the delphi compiler has a bug for 64 bit integers, inc( a, b) when compiling in 32 bit mode. In other words: don't worry about left side and such, eventually the compiler will completely fail for these kinds of code. It is unfixeable with inc/dec. - Skybuck Flying

1 Answers

8
votes

You can only use inc and dec with variables. You are passing properties instead and they are not variables.