Skip to main content

In-place Editors

  • 3 minutes to read

The TreeList control provides the ability to use different editors to edit column values. There are a number of editors that can be used for this purpose.

When a column is bound to a data source field, an editor corresponding to the bound field type is assigned to the column. For instance, if a column is bound to a Boolean field, a check box (TcxCheckBox) is used to edit column values. The correspondence of field types to default editors is presented in the cxEditDBRegisteredRepositoryItems unit. You can change the default editors via the DBRepositoryItemClasses array declared in this unit.

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

Repository

A repository (TcxEditRepository) represents storage of repository items each of which defines properties specific to the 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 a column, you have to set the column’s RepositoryItem property.

The advantage of using repository items is that you can assign a single one to several columns, thus providing the same behavior.

The Editor Properties Class

Every column has a Properties property and this can be used to assign a particular editor to a column. After setting Properties, you can access and modify the editor’s properties via the Properties object’s sub-properties.

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

Selecting an item from this list initializes the PropertiesClass property with the corresponding editor’s properties class. For instance, the TcxTimeEditProperties class holds the properties necessary for time edit fields.

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

When both Properties and RepositoryItem are assigned, the editor is determined by the RepositoryItem object.

Multi-Editor Cells

You can dynamically specify a cell’s in-place editor type by handling a column’s OnGetEditingProperties event. To dynamically specify a cell’s display value formatting editor type, handle a column’s OnGetEditProperties event.

Sizing Modes in Multi-Line Editors

Use the EditAutoHeight property to switch the sizing mode for multi-line in-place editors.

See Also