[英]Delphi-FireMonkey-Undeclared Identifier 'TEdit' ;Undeclared Identifier 'TLabel';
我正在Firemonkey-RAD Studio XE3-Delphi中的实践应用程序上工作。 实施代码时,出现以下错误:
未声明的标识符'TEdit'未声明的标识符'TLabel''TLabel'在第35行中不包含名为'caption'的成员
我在以下正文中包含了该项目的代码。
任何帮助表示赞赏。 放轻松吧..我是Delphi的新手。
unit strcode1u1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
Tstrcode1f1 = class(TForm)
ePlainText: TEdit;
laEncrypted: TLabel;
procedure ePlainTextChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
strcode1f1: Tstrcode1f1;
implementation
{$R *.dfm}
procedure Tstrcode1f1.ePlainTextChange(Sender: TObject);
begin
end;
procedure Tstrcode1f1.FormCreate(Sender: TObject);
begin
laEncrypted.caption:=
chr(72)+chr(101)+chr(108)+
chr(108)+chr(111)+chr(32)+
chr(87)+chr(111)+chr(114)+
chr(108)+chr(100);
end;
end.
你说你正在创建一个FireMonkey应用程序,但你的uses
条款包含VCL单元的参考:
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs
代替FireMonkey单位:
FMX.Controls, FMX.Forms, FMX.Dialogs
除了@Remy的答案外,还有另一个问题。 如您在对象检查器中看到的那样, TLabel
中的TLabel没有标题。
它(和所有其他FMX控件)改用Text
。
首先创建一个新的FireMonkey应用程序(IDE主菜单中的File-> New-> FireMonkey Desktop Application-Delphi)。 当出现下一个对话框时,选择是要FireMonkey HD还是3D应用程序(文档可以解释两者之间的区别)。
然后,您可以在窗体上放置TLabel和TEdit,在“对象检查器”中正确命名它们,然后将代码更改为此:
aEncrypted.Text:= chr(72)+chr(101)+chr(108)+
chr(108)+chr(111)+chr(32)+
chr(87)+chr(111)+chr(114)+
chr(108)+chr(100);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.