Show: Delphi C++
Display Preferences

Understanding the Component Library

From RAD Studio
Jump to: navigation, search

Go Up to Understanding the Component Library Index


The VCL component library is made up of objects that you can use in your projects. The VCL-RTL contains low-level classes and routines available for all VCL applications. VCL-RTL includes the runtime library (RTL) up to and including the Classes unit. Use the VCL when you want to use native Windows controls, Windows-specific features, or extend an existing VCL application. All classes in the VCL descend from TObject. TObject introduces methods that implement fundamental behavior like construction, destruction, and message handling.

The VCL is a class library made up of objects that you use when developing applications. Use the VCL when you want to use native Windows controls, Windows-specific features, or extend an existing VCL application. All VCL objects descend from System.TObject, an abstract class whose methods encapsulate fundamental behavior like construction, destruction, and message handling. When you write classes of your own, they should descend from TObject in the class library you plan to use.

Components are a subset of the component library that descend from the class System.Classes.TComponent. You can place components on a form or data module and manipulate them at design time. Using the Object Inspector, you can assign property values without writing code. Most components are either visual or nonvisual, depending on whether they are visible at run time. Some components appear on the Tool Palette.

Visual components, such as Vcl.Forms.TForm and TSpeedButton, are called controls and descend from Vcl.Controls.TControl. Controls are used in GUI applications, and appear to the user at run time. TControl provides Properties, Methods, and Events that specify the visual attributes of controls, such as their height and width.

Nonvisual components are used for a variety of tasks. For example, if you are writing an application that connects to a database, you can place a Data.DB.TDataSource component on a form to connect a control and a dataset used by the control. This connection is not visible to the user, so TDataSource is nonvisual. At design time, nonvisual components are represented by an icon. This allows you to manipulate their properties and events just as you would a visual control.

Classes that are not components (that is, classes that descend from TObject but not TComponent) are also used for a variety of tasks. Typically, these classes are used for accessing system objects (such as a file or the clipboard) or for transient tasks (such as storing data in a list). You cannot create instances of these classes at design time, although they are sometimes created by the components that you add in the Form Designer.

Detailed reference material on all VCL objects is accessible while you are programming. In the Code Editor, place the cursor anywhere on the object and press F1 to display the Help topic. If more than one help topic exists for the selected object, a Topics Found dialog box is diplayed, and objects, properties, methods, and events that are in the VCL are marked "RAD Studio VCL Reference."

See Also

Personal tools
In other languages