【发布时间】:2011-03-30 08:57:27
【问题描述】:
我阅读了this question in which the same problem is discussed,无论如何我可以在 Delphi 2009 中做到这一点,但当我升级到 XE 时这是不可能的。
我在这里粘贴一个简单的虚拟示例:它在 2009 年编译并在 XE 上给出 E2064... 为什么?是否可以将 XE 设置为像 2009 一样?还是我应该寻求解决方法?
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TTestRecord = record
FirstItem : Integer;
SecondItem : Integer;
end;
TForm2 = class(TForm)
procedure AssignValues;
private
FTestRecord :TTestRecord;
public
property TestRecord : TTestRecord read FTestRecord write FTestRecord;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.AssignValues;
begin
with TestRecord do
begin
FirstItem := 14; // this gives error in XE but not in 2009
SecondItem := 15;
end;
end;
end.
【问题讨论】:
-
这是我讨厌 WITH 语句的一个完美例子。 :-) 即使在 2009 年构建时,它也做了一些奇怪的事情,您在调试器中查看值时会遇到问题。
标签: delphi compiler-errors delphi-2009 delphi-xe