Skip to main content

Edit Repository Items

  • 2 minutes to read

The Repository represents a TcxEditRepository component, which supports a collection of repository items. Repository items define settings specific to corresponding editors. The ExpressEditors Library provides repository items for every editor it contains. For instance, it provides a TcxEditRepositoryCheckBoxItem for the TcxCheckBox editor. Repository items are descendants of the base TcxEditRepositoryItem class. Every repository item declares a Properties member via which you can adjust different attributes specific to a corresponding editor.

There are two main tasks repository items solve.

The first is to define the properties common to several editors. Use the Properties attribute of a repository item to adjust specific editor properties. To set a repository item for an editor, use the editor’s RepositoryItem property. Each modification of a repository item’s properties results in the update of the properties of all linked editors and vice versa.

When you set a repository item for an editor, the editor uses the properties of the repository item (the editor’s properties are preserved and are restored when clearing the RepositoryItem property).

The second task is to specify the editor with which to edit data of grid items (grid items represent columns in a grid table view and rows in a card view). A grid editor is created based on the information obtained from the repository item assigned via TcxCustomGridTableItem.RepositoryItem. Editors are not created for all item cells at once. Only one editor instance exists per item at a time. Editors are not created for the other item cells. Instead, cells are drawn with the help of the corresponding ViewInfo object and this knows how to render an editor on a canvas. The ViewInfo object is retrieved via the virtual GetViewInfoClass function of the TcxEditRepositoryItem.Properties object.

When an editor must be created, information on the editor’s class is also obtained from the Properties object of a repository item via the GetContainerClass function. After an editor is instantiated, the Properties member of a repository item is assigned to the Properties member of the edit control, thus creating an editor with the required behavior.

You can use the Edit Repository dialog to add repository items at design time. Just place a TcxEditRepository component onto a form and double-click the icon to open the dialog:

The Add button allows you to add a repository item of the required type. To adjust the properties of a repository item, use the Object Inspector.

See Also