The Repository Concept
- 2 minutes to read
The ExpessVerticalGrid control enables you to assign editors to data cells. This allows you to represent cell values in a more readable form and facilitates modifying or entering data.
When a vertical grid control is connected to a data storage, its rows are assigned default editors according to the data field type. The correspondence of field types to default editors is presented in the cxEditDBRegisteredRepositoryItems unit. You can change the default editors to assign via the DBRepositoryItemClasses array.
If a default editor does not suite your needs, you can explicitly assign an appropriate editor. Assignment of an editor to an item can be done in two ways: via the repository mechanism and by using the editor properties class. This topic describes using the editors repository.
The editors repository functionality is encapsulated in the TcxEditRepository component. This component provides a storage of repository items, each of which defines properties of a particular editor. TcxEditRepository provides repository items for every editor within the ExpressEditorsLibrary.
The main advantage of the repository technology is that a repository item can be assigned to multiple rows of the same data type, and not only that, a single repository item can be used within all Developer Express products concerned with data editing.
The following steps describe how to assign a repository item to a vertical grid row.
- Drop a TcxEditRepository component on a form. Double click it to invoke the repository editor. Press the Add button to add a repository item:
- After a repository item has been created, you can modify its properties via the Object Inspector:
- When all the repository item settings have been defined, it can be assigned to a vertical grid row:
- The ExpressVerticalGrid instantly reflects the changes made:
Note: If using Delphi versions prior to Delphi 6 to avoid runtime exceptions include the uses clause with unit source files where the editors you intent to use in your application are implemented. For example:
//...
uses cxCheckComboBox, cxProgressBar;