RAD Studio
ContentsIndex
PreviousUpNext
Using Component Properties and Events in a Data Module

Placing components in a data module centralizes their behavior for your entire application. For example, you can use the properties of dataset components, such as TClientDataSet, to control the data available to the data source components that use those datasets. Setting the ReadOnly property to True for a dataset prevents users from editing the data they see in a data-aware visual control on a form. You can also invoke the Fields editor for a dataset, by double-clicking on ClientDataSet1, to restrict the fields within a table or query that are available to a data source and therefore to the data-aware controls on forms. The properties you set for components in a data module apply consistently to all forms in your application that use the module. 

In addition to properties, you can write event handlers for components. For example, a TDataSource component has three possible events: OnDataChange, OnStateChange, and OnUpdateData. A TClientDataSet component has over 20 potential events. You can use these events to create a consistent set of business rules that govern data manipulation throughout your application.

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