我试图用FireMonkey平台(XE7)创建一个非常简单的组件(Tgraph)。首先,我创建了两个新类: 1)TGraph(anchestor type TLayout); 2)TMyPlot1D(anchestor type Tpanel); 我保存了两个单元并创建了一个名为“MyPackage”的包。我编译并安装在“Samples”页面中。我打开了一个新的Firemonkey项目,并将TGraph实例拖放到窗体中。一切运作良好。在设计时,我可以看到已定义的组件,并且所有相关单元都可以从主单元看到。相关的代码是在以下几点:FireMonkey组件执行错误
头等舱
unit UMyPlot;
interface
uses
System.SysUtils, System.Classes, FMX.Types,
FMX.Controls, FMX.StdCtrls;
type
TMyPlot1D = class(TPanel)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMyPlot1D]);
end;
end.
二等
unit UMyGraph;
interface
uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.Layouts,
UMyPlot;
type
TMyGraph = class(TLayout)
private
Plot : TmyPlot1D;
public
constructor create(Aowner:TComponent); override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMyGraph]);
end;
constructor TMyGraph.create(Aowner: TComponent);
begin
inherited;
Plot := TMyPlot1D.Create(Self);
plot.Parent := Self;
end;
end.
,当我尝试运行我的应用程序的问题所示。 我得到了以下错误: “在模块Project1.exe在000A51FA。类未找到类TmyPlot1D异常EClassNotFound”。失败的函数似乎是Application.RealCreateForms。
如果我只拖放TmyPlot1D实例,它在设计时和运行时都会起作用(当然)!
任何想法?
在此先感谢
非常感谢。现在看来工作。 – Damiano 2015-04-02 12:34:13