1. Technology

Custom Component Development

Everything about creating custom components in Delphi. The ultimate source.


That's why you love Delphi!

I think we can all agree: components are essential elements of the Delphi environment. One of the most important features of Delphi is that we can use Delphi to create our own components.
We can derive a new component from any existing component, but the following are the most common ways to create components: modifying existing controls, creating windowed controls, creating graphic controls, subclassing Windows controls and creating nonvisual components. Visual or not, with or without property editor, from scratch...you name it.

Developing Delphi components isn't a simple task, it involves quite a bit of knowledge of the VCL. However, developing custom components is not an impossible task; writing components is just pure programming.

Articles, papers, tutorials
What follows is a list of articles that deal with custom component development in Delphi.

  • Accessing protected members of a component
    Many Delphi components have useful properties and methods that are marked invisible ("protected") to a Delphi developer. In this article you will find the workaround to this problem - thus enabling you to access a DBGrid's RowHeights property, for example.

  • Creating Custom Delphi Components - Inside and Out
    This tutorial will explain component writing to you, which should result in more code reuse. It will go over properties, events and methods, and will also explain how to install components. The final part of this tutorial is about Object-Oriented design.

  • Creating Custom Delphi Components, Part I
    This first part demonstrates some of the best approaches to building components, and at the same time provides tips on deciding on the best base class to inherit from, using virtual declarations, the complexities of overriding, and so on.

  • Creating Custom Delphi Components, Part II
    Quite often it is necessary to write components that perform more advanced functions. These components often need to either reference other components, have custom property data formats, or have a property that owns a list of values rather than a single value. We will explore various examples covering these very subjects, starting with the most simple.

  • Creating Custom Delphi Components, Part III
    This article is the final part of a three part article on components. Part one covered the basic creating of components, part two covered how to write advanced properties, how to write custom streaming for those properties, and sub-properties. This final part will cover property / component editors, how to write dedicated editors for your component / property, and how to write "hidden" components.

    More resources

    First, if you want more, consider buying a book on Developing custom components.
    Second, why not try locating an existing (with source perhaps) component you are looking for.
    Third, when you are 100% sure there is no such question on custom component development you can't answer...there will be something that you don't know. Everything you have to do is to ask a question on the Delphi Programming Forum and wait for answers.

    If you still need more samples .. try the second page ...

  • ©2014 About.com. All rights reserved.