Delphi Programming
Register
Advertisement

Overview[]

The Visual Component Library (VCL) is visual part of Delphi's object oriented class library. Delphi's class library consists of a huge number of classes descending from TObject, the root object, and the VCL generally comprises the classes that descend from TComponent. Thus VCL classes are generally termed components. It was developed by Borland for use in its Delphi and C++ Builder software development environment. It is written in Object Pascal. Much of the popularity of VCL comes from its tight integration with visual RAD tools from Borland.

A cross-platform equivalent of VCL called CLX (Component Library for Cross Platform) was later developed for use in Delphi, C++ Builder and Kylix, it was however abandoned in favor of VCL.

As an object-oriented approach, the VCL forms an object hierarchy where all other objects inherit or indirectly inherit the TObject class (thus, TObject is a superclass). This is necessary as Delphi does not support multiple inheritance, unlike C++.

VCL classes can be created either visually at design-time or programatically at run-time.

Contrary to its name, the VCL contains both visual and non-visual components. Beginning Delphi application programmers will generally first interact with the VCL by using the form editor, which allows programmers to visually design a window by placing components on it. The common components located on the Component Palette, such as buttons, text fields, check boxes, radio buttons, panels and dialogs are all part of the VCL.

Visual and Non Visual Components[]

Any class that descends from TComponent may appear on the component palette for convenient use at design time. The user simply selects the component from the palette and places it on a form or data module.

Any component that descents from TControl is a visual component. If it does not it is a non-visual component and is represented on a form or data module as a small square. Data modules may only contain non-visual components.

Visual components, also known as controls, are typically user interface elements such as buttons, text fields or more complicated components, such as tree views. Non visual components typically perform some utility function, such as managing database connections, submitting queries to a database, providing access to common dialogs, and so forth.

Many VCL components, particularly those that descend from TWinControl, are wrappers around the Windows API. For example, the TButton control simply wraps the Windows API calls that create a standard Windows button and manages its properties, methods and events. In cases where low-level functions need to be performed, components generally expose a Handle property giving the programmer access to the underlying Windows control. This drastically simplifies development, since the TButton component is much easier to use than raw API calls or simpler wrappers such as MFC, yet it allows direct access if necessary.

Extensibility[]

One of the early advantages of Delphi over other RAD (rapid application development) tools was the ability to use the same tool to build controls for use with the tool.

Delphi allows intermediate users to easily build their own visual and non-visual components by descending from existing components and modifying it's behavior.

See Also[]

Advertisement