2

Can I use a custom control (e.g. a TEdit descendant) at design time directly, without design time package? I don't want to create any package for that control, because it is only one, project specific etc.

Thank you

tk_
  • 490
  • 3
  • 15
  • Why is creating a package such a problem for you? It's simple to do especially since you need it only for one project. You don't even need to create two distinct (runtime/designtime) packages but could get away with one. – dummzeuch Jan 11 '16 at 08:48
  • I don't know, maybe I am too lazy or I just don't want that other developers of our sw will be required to install it (and reinstall it over and over again on each Delphi upgrade, computer change etc.). Maybe I want to avoid package hell. Interesting is that eg. frames or forms from the project can be inherited in it without a package but other ui controls not. – tk_ Jan 11 '16 at 18:01

2 Answers2

2

The IDE is based upon packages, so no, you can not use a control at design time without a package.

But you have two somewhat corners-cutting options. They are not exactly what you asked, but might appear somewhat close and save you some work in short time (but in the long run would make maintenance more complex).

  1. Delphi comes with the User's Custom Controls package - that is specifically made to contain users' single controls that are not worth their own package.
    PS. Uwe Raabe corrects me that since Delphi XE that package is no more available. So the most close option would be Component | Install Component... wizard in IDE, providing for lazy creation of new package... In other words one only has option #1 when using Delphi 2010 and below.

  2. If your TEdit does not have many differences from VCL's TEdit in design time, you can use stock TEdit in design-time and only substitute your custom descendent in runtime. Runtime-only hijacking method (on TButton example) is shown at my answer to How to efficiently let a `ParentFont = False` child control to use same font name as parent?

Community
  • 1
  • 1
Arioch 'The
  • 15,799
  • 35
  • 62
2

No. A UI control must be in a package to be usable at design-time. However, a UI control can be instantiated at runtime without being in a package.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770