Tra*_*cer 2 delphi components vcl
我的新组件(TComponent)使用DsgnIntf,因为我使用自定义属性编辑器.问题是在自定义VCL应用程序中使用该组件时 - 找不到DSGNINTF.DCU!一种解决方案是将命令行开关添加到编译器(不记得它是什么),但我不喜欢这个解决方案.第二种解决方案是单位隔离.我找到了这个:
http://edn.embarcadero.com/article/27717
问题是 - 我不太了解这篇文章.我不知道在组件单元中我需要做什么才能将设计时与运行时代码分开.有人可以做出最简单的例子并解释一下吗?我只是想避免在人们使用我的组件时出现"dsgnintf.dcu not found"的问题.谢谢.
编辑:我看了一下这篇文章,我意识到第二个单元注册了第一个.为了避免dsgnintf.dcu问题我假设第二个单元必须在它自己的.pas文件中?
通常您创建一个单元来在IDE中注册您的包,类似于:
unit RegPackage;
interface
uses
Classes, MyUnit;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyPage', [TMyComponent]);
end;
end.
Run Code Online (Sandbox Code Playgroud)
并将此单元包含在仅设计包中:
package MyPackD;
{$R *.res}
..
requires
rtl, MyPackR; // your runtime package
contains
RegPackage in 'RegPackage.pas';
end.
Run Code Online (Sandbox Code Playgroud)
您链接的文章还包括属性编辑器.与IDE无关的所有包代码都应包含在只运行包中:
package MyPackR;
{$R *.res}
..
requires
rtl,
vcl;
contains
MyUnit in 'MyUnit.pas';
end.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
373 次 |
| 最近记录: |