My new component (TComponent) uses DsgnIntf since I use custom property editors. The problem is when using the component in a custom VCL application - DSGNINTF.DCU not found! One solution is to add a command line switch to a compiler (dont remember any more what is it), but I don't like that solution. The second solution is a unit segregation. I found this:
http://edn.embarcadero.com/article/27717
The problem is - I don't understand this article so well.. I don't know what exactly I need to do in my component unit to separate design-time from runtime code. Could someone please make the simplest example and explain it? I just want to avoid problems with "dsgnintf.dcu not found" when people using my component. Thank you.
EDIT: I looked the article a bit more and I realize the second unit registers the first one. To avoid dsgnintf.dcu problem I presume the second unit must be in it's own .pas file?
Usually you create a single unit to register your package in IDE, something like that:
unit RegPackage;
interface
uses
Classes, MyUnit;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyPage', [TMyComponent]);
end;
end.
and include this unit into design-only package:
package MyPackD;
{$R *.res}
..
requires
rtl, MyPackR; // your runtime package
contains
RegPackage in 'RegPackage.pas';
end.
The article you link covers also property editors. All package code not related to IDE should be contained in run-only package:
package MyPackR;
{$R *.res}
..
requires
rtl,
vcl;
contains
MyUnit in 'MyUnit.pas';
end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With