RAD Studio
ContentsIndex
PreviousUpNext
Placing and Naming Components

You place nonvisual components in a data module just as you place visual components on a form. Click the desired component on the appropriate category of the Tool palette, then click in the data module to place the component. You cannot place visual controls, such as grids, on a data module. If you attempt it, you receive an error message. 

For ease of use, components are displayed with their names in a data module. When you first place a component, the module assigns it a generic name that identifies what kind of component it is, followed by a 1. For example, the TDataSource component adopts the name DataSource1. This makes it easy to select specific components whose properties and methods you want to work with. 

You may still want to name a component a different name that reflects the type of component and what it is used for.

To change the name of a component in a data module:

  1. Select the component.
  2. Edit the component's Name property in the Object Inspector.
The new name for the component appears under its icon in the data module as soon as the Name property in the Object Inspector no longer has focus. 

For example, suppose your database application uses the CUSTOMER table. To access the table, you need a minimum of two data access components: a data source component (TDataSource) and a table component (TClientDataSet). When you place these components in your data module, the module assigns them the names DataSource1 and ClientDataSet1. To reflect the type of component and the database they access, CUSTOMER, you could change these names to CustomerSource and CustomerTable.

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