tk_
tk_

Reputation: 570

Delphi use custom controls at design time without package

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

Upvotes: 2

Views: 662

Answers (2)

Arioch 'The
Arioch 'The

Reputation: 16045

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?

Upvotes: 2

Remy Lebeau
Remy Lebeau

Reputation: 596196

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.

Upvotes: 2

Related Questions