[英]Delphi-FireMonkey-Undeclared Identifier 'TEdit' ;Undeclared Identifier 'TLabel';
I'm working on a practice Application in Firemonkey-RAD Studio XE3-Delphi. 我正在Firemonkey-RAD Studio XE3-Delphi中的实践应用程序上工作。 When implementing code I get the following errors:
实施代码时,出现以下错误:
Undeclared Identifier 'TEdit' Undeclared Identifier 'TLabel' 'TLabel' does not contain a member named 'caption' at line 35 未声明的标识符'TEdit'未声明的标识符'TLabel''TLabel'在第35行中不包含名为'caption'的成员
I included the code form the project in the following body. 我在以下正文中包含了该项目的代码。
Any help is appreciated. 任何帮助表示赞赏。 Go easy on me..I'm new to Delphi.
放轻松吧..我是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.
You say that you are creating a FireMonkey app, but your uses
clause contains references to VCL units: 你说你正在创建一个FireMonkey应用程序,但你的
uses
条款包含VCL单元的参考:
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs
Instead of FireMonkey units: 代替FireMonkey单位:
FMX.Controls, FMX.Forms, FMX.Dialogs
In addtion to @Remy's answer, there's an additional issue. 除了@Remy的答案外,还有另一个问题。
TLabel
in FireMonkey doesn't have a caption, as you can see in the Object Inspector. 如您在对象检查器中看到的那样,
TLabel
中的TLabel没有标题。
It (and all of the other FMX controls) use Text
instead. 它(和所有其他FMX控件)改用
Text
。
Start by creating a new FireMonkey application (File->New->FireMonkey Desktop Application - Delphi from the IDE's main menu). 首先创建一个新的FireMonkey应用程序(IDE主菜单中的File-> New-> FireMonkey Desktop Application-Delphi)。 When the next dialog appears, choose whether you want a FireMonkey HD or 3D application (the documentation can explain the difference between the two).
当出现下一个对话框时,选择是要FireMonkey HD还是3D应用程序(文档可以解释两者之间的区别)。
You can then drop a TLabel and TEdit on your form, name them properly in the Object Inspector, and change your code to this instead: 然后,您可以在窗体上放置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.