RAD Studio |  |

Modifying Existing Controls
See Also
Collapse All

The simplest way to create a component is to customize an existing one. You can derive a new component from any of the components provided in the component library.

Some controls, such as list boxes and grids, come in several variations on a basic theme. In these cases, the component library includes an abstract class (with the word "custom" in its name, such as TCustomGrid) from which to derive customized versions.

For example, you might want to create a special list box that does not have some of the properties of the standard TListBox class. You cannot remove (hide) a property inherited from an ancestor class, so you need to derive your component from something above TListBox in the hierarchy. Rather than force you to start from the abstract TWinControlclass and reinvent all the list box functions, the component library provides TCustomListBox, which implements the properties of a list box but does not publish all of them. When you derive a component from an abstract class like TCustomListBox, you publish only the properties you want to make available in your component and leave the rest protected.

The section Creating properties explains publishing inherited properties. The section Modifying an existing component and the section Customizing a grid show examples of modifying existing controls.

See Also

Generic Components

Windowed Controls

Graphical Controls

Subclassed Controls

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!