Monday, February 19, 2007

Delphi: Still more to explore

The real fun with Delphi is that you discover functions and tools that were sitting there, probably for years, without being noticed by you at all. A good example is the possibility to search incremental using CTRL+E, which I blogged about a year ago.

Today such an event occured to me again. Suddenly I noticed at the main menuitem 'Component' the item 'Create component template...'.

Humm what would that be?

Component templates gives you the ability to create a 'snapshot' of a component(or several components) at the time of creation that you can place in a category of your toolpalette. With the purpose of using it again as it is. Man so simple but so effective!

For instance how many times did you populate a TOpenDialog to open a Word Document? (Drop the component, set the filters etc.) Now you do this one time, and then create a Component Template named 'TOpenDialogWordDocuments' (or whatever) and next time you need an Open dialog for Word documents  just use the component template and ready!

As said you can use Component Templates with more then one component so that you can 'wrapp up'  components to one component.

Great stuff! At what version of Dephi was this introduced?


Thomas Mueller said...


same here. There was a blog post somewhere about component templates and I thought, "Hey, you knew it was there, but never actually used it.". So I went and wrote an article in the Delphi Wiki about it, just so I can look it up again.


Marco Breveglieri said...

I know about "Component Templates" since Delphi 4 (if I remember well, of course). :-)

I usually prefer going through OOP and inheritance for creating specialized components, or group components and controls in Frames, but Component Templates can be "fast and furious" for the simplest needs in replicating components, properties and even their code!


Steve Trefethen said...

Be sure to check out my video of code completion features which talks about several features which have been hidden away for years.