Skip to main content

Multi Editor Rows

  • 4 minutes to read

Multi Editor Rows are used to display and edit a group of logically related data items. Multi Editor Rows have the following format: a set of header cells in a header column and a set of data cells in a data column.

The header cell contains descriptive information about the item while the data cell is a container for a data item where this item is displayed and edited.

Features of Multi Editor Rows

Settings that manage the Multi Editor Row (represented by the TcxCustomMultiEditorRow class) fall into four groups. The following classes represent these groups:

  1. The TcxCustomRow class provides properties common to all the types of rows published in its subclasses while the TcxMultiEditorRow.Properties property represents settings custom to the Multi Editor Row.

  2. The TcxRowOptions class provides options common to all types of rows. The TcxMultiEditorRow.Options property references the TcxRowOptions object.

  3. The TcxMultiEditorRowProperties class provides settings inherited from the TcxCustomRowProperties class and settings it implements that define the Multi Editor Row behavior. The most important property, TcxMultiEditorRowProperties.Editors is used to assign an item to the Multi Editor Row. See the description on Multi Editor Row items in this topic below. The TcxMultiEditorRow.Properties property references the TcxMultiEditorRowProperties object.

  4. The TcxEditorRowStyles class provides style settings inherited from the TcxCategoryRowStyles class and implemented in its own. The TcxMultiEditorRow.Styles property references the TcxEditorRowStyles object.

The following image demonstrates the settings of Multi Editor Rows in the Object Inspector at design time:

Multi Editor Row Items

An item in the Multi Editor Row is used to display and edit an underlying data item. The TcxEditorRowItemProperties class represents the Multi Editor Row item, this class provides editing capabilities for a data item. As mentioned above the Multi Editor Row is a container for a group of logically related items. The TcxMultiEditorRowProperties.Editors property represents a collection where all items for the specified Multi Editor Row are cached.

Creating Items at Design Time

To create or get access to the item at design time follow these steps:

  1. Click on the button for the Editors property or double-click on this property in the Object Inspector. The editor properties collection editor window appears, click on the Add New (Ins) icon in the toolbar to create an item. Now settings of the newly created item are available in the Object Inspector. Name the TcxEditorRowItemProperties.Caption property “MPG City”.

  1. Assign the underlying data item to this item. In this case use the TcxDBVerticalGridItemDataBinding.FieldName property to bind the MPG_City field of the Cars database in the Cars table, which is shipped with demo applications. Note that you must have a database connection ready. For more details on how to configure a data-aware vertical grid please refer to the Bound Mode topic.

  2. If you need a specific editor to display and edit the item’s values you can specify one using the TcxDBEditorRowItemProperties.EditProperties property as shown below:

See also Assigning Editors To MultiEditor Rows for more detailed explanations. The default editor will be assigned if you skip the third step.

Repeat the steps mentioned above for the MPG Highway item, except invoking the Editor properties collection editor if you did not close the Editor properties collection editor window.

If everything is working okay, you should have something that looks like this:

Creating Items at Runtime

The following code snippet creates items with the TcxMultiEditorRow object within the TcxVerticalGrid:

//...
// Create the MPG City item, define type for data item and assign appropriate editor
with MultiEditorRow1.Properties.Editors.Add do
    begin
        DataBinding.ValueTypeClass := TcxIntegerValueType;
        EditPropertiesClass := TcxSpinEditProperties;
        Value := 16;
     Caption := 'MPG City';
    end;
//...
// Create the MPG Highway item, define type for data item and assign appropriate editor
with MultiEditorRow1.Properties.Editors.Add do
    begin
        DataBinding.ValueTypeClass := TcxIntegerValueType;
        EditPropertiesClass := TcxSpinEditProperties;
        Value := 23;
  Caption := 'MPG Highway';
    end;

When running this code the output will be:

When creating items for the TcxDBVerticalGrid you have to map an item to the database table field:

//...
// Bind the MPG City item to the MPG_City database table field and assign appropriate editor
with DBMultiEditorRow1.Properties.Editors.Add do
    begin
       DataBinding.FieldName := 'MPG_City';
 EditPropertiesClass := TcxSpinEditProperties;
       Caption := 'MPG City';
    end;