Collection Editor

From Appmethod Topics
Jump to: navigation, search

Go Up to Property Editors Index

The Collection Editor is used to edit the items maintained by a collection object. A collection object is a descendant of System.Classes.TCollection. The Collection Editor displays information about the items in the collection, and allows you to add, remove, or rearrange the individual items. For some collections, additional buttons are provided to allow other manipulations of the list.

The items displayed in the list window of the Collection Editor can be selected using the mouse. Once an item is selected, its properties and events can be set using the Object Inspector.

Opening the Collection editor

To display the Collection editor, first place the component that uses the collection on a form. Select the property that is implemented using the collection (listed in parentheses in the preceding table), and click on the ellipsis. For some components, the Collection Editor may also be displayed by right-clicking the component, and selecting the appropriate editor from the context menu.

Dialog box options

The following options are available in the Collection editor.

Item list

The Item list displays the properties listed in the third column of the preceding table for each item in the collection. The properties for a selected item are displayed in the Object Inspector and are edited there.

Add button

Adds a new item to the collection. You can select the item and edit its parameters in the Object Inspector.

Delete button

Removes the selected item from the collection.

Move Up/Down buttons

Change the order of the items. For most collections, the order determines the order in which items are displayed or used by the object that maintains the collection.

Add All Fields button (TDBGridColumns only)

Add a column for every field in the dataset to which the data-aware grid is bound. This button is only enabled if the data-aware grid is bound to an active dataset.

Restore Defaults button (not for all collections)

Restore the default properties (obtained from the field component) of the currently selected column. This button is enabled if the currently selected column is bound to a field (the FieldName property is set).

Read From Dictionary button (TCheckConstraints only)

Add a CheckConstraint object for every record-level constraint in the data dictionary. Each CheckConstraint object will have its ImportedConstraint property set to the constraint from the dictionary.

Examples of collection items

The following table provides examples of collection items. Note that the list is not complete as new collection items are being added all the time.

Collection

Item type

Properties displayed

Use

TAggregates

TAggregate

Aggregates

At design time, you can use the editor to add aggregate fields to a client dataset. When you define aggregate fields at design time, the editor automatically creates the TAggregate objects for them.

TCheckConstraints

TCheckConstraint

ImportedConstraint, or, if no ImportedConstraint is blank, CustomConstraint

Represents record-level constraints for the data in a dataset.(Constraints property)

TCoolBands

TCoolBand

Text

Represents a set of bands in a CoolBar component.(Bands property)

TDBGridColumns

TColumn

FieldName

Represents the field binding and display properties of a column in a data-aware grid.(Columns property)

TIndexDefs

TIndexDef

IndexDefs

Describes an index in a database table.

THeaderSections

THeaderSection

Text

Represents the display properties of the sections in a HeaderControl object.(Sections property)

TListColumns

TListColumn

Caption

Represents the columns of a report-style List View component.(Columns property)

TStatusPanels

TStatusPanel

Text

Represents the individual panels of a StatusBar component.(Panels property)

TWebActionItems

TWebActionItem

Name, PathInfo, Enabled, and Default

Represents the action items that create the responses to HTTP request messages for a Web dispatcher or Web module.(Actions property)