Skip to main content

Data Editing Using Inplace Editors

  • 3 minutes to read

The ExpressQuantumGrid provides you with two end-user options for editing the grid View’s cell data: in-place editors or special panels called in-place Edit Forms. You can select the required option (also called edit mode) using the View’s OptionsBehavior.EditMode property. This topic describes the features offered by the in-place editors (the property is set to emInplace). To learn about the capabilities provided by the in-place Edit Forms, refer to the Data Editing Using Inplace Edit Forms topic.

The ExpressQuantumGrid gives you the ability to use different editors to edit the values of grid items. There are many ExpressEditors and these enable you to edit text, date/time values, graphical fields, etc.

An item linked to a dataset field in a data-aware View is automatically assigned a default editor according to the field type. For instance, if an item is linked to a Boolean field, a check box (TcxCheckBox) is used to edit the column’s values. The correspondence of field types to default editors is presented in the cxEditDBRegisteredRepositoryItems unit. You can change the default editors assigned via the DBRepositoryItemClasses array.

If a default editor does not suit your needs, you can assign an appropriate editor explicitly. Assigning a specific editor to an item can be done in one of two ways: via the repository mechanism or by using the editor properties class.

Repository

A repository (TcxEditRepository) represents a storage of repository items each of which defines properties that are specific to a corresponding editor. There is a repository item for every editor in the ExpressEditors Library.

After you have added a repository item, you can adjust its properties in the Object Inspector.

To assign an editor to an item (column), you have to set the item’s RepositoryItem property.

The point of using repository items is that you can assign the same one to several columns, thus specifying the same behavior.

Editor Properties Class

Every item (column) has the PropertiesClass field and this can be used to assign a particular editor to a column. After setting the PropertiesClass you can access and adjust the editor’s properties via the column’s Properties field.

The following code shows how to specify the BLOB editor to edit the cxGrid1DBTableView1Graph1 item data. Its type is set to bekPict to enable displaying graphics via the editor.

cxGrid1DBTableView1Graph1.PropertiesClass := TcxBLOBEditProperties;
  TcxBLOBEditProperties(cxGrid1DBTableView1Graph1.Properties).BlobEditKind := bekPict;

At design time, you can use the Object Inspector to assign editor properties. The column’s Properties field provides a drop-down list containing all the available editors.

Selecting the item from this list initializes the PropertiesClass field with the corresponding editor’s properties class. These classes handle the requirements of different data types. For instance, the TcxMaskEditProperties class holds the properties required for mask edit fields.

To customize the properties of an assigned editor, expand the Properties entry in the Object Inspector:

When both the PropertiesClass and RepositoryItem are assigned, the editor for a column is determined by the RepositoryItem object. You can obtain the reference to the edit properties by calling the GetProperties method.

The ExpressQuantumGrid gives you the ability to specify different editors for individual item cells. You can handle the OnGetProperties event and specify an editor depending on a record’s position or the data associated with it.

See Also