Key Properties

There are a number of properties that control the display elements of the DBGrid component, some of which will make their only appearance in this context.

Columns

The Columns property is an indexed collection of TColumn objects, This property is used to view or set the display attributes or field bindings that make up the column collection. The columns can be modified at design time by using the Columns editor or through the application at run time. This object is of type TDBGridColumns, a container to hold the collection of TColumns. DBGridColumns can return the number 0f columns, or index numbers, for the collection. Each column has its own set of properties, listed in the table in Figure 6.2.

Default Value Purpose

Determines the justification of the values within the column.

Th e value of this property determines if ;and how a value can be selected if the column is connected to a lookup file or has a value in its PickList property. Determines the color for the column. This property determines the number of rows displayed in a drop-down list if the column is connected to a lookup table or has values in its PickList property. Action depends on the setting of the ButtonStyle property.

Determines whether or not the column is ovninHorl

Default Value Purpose

This setting determines the text display attributes for the column.

This property specifies the Input Method

Editor behavior.

Specifies the name of the input Method Editor.

This property specifies the popup ITI01U associated with this column.

Determines whether or not the data in the column can be edited.

¡Specifies a TColumnTitle object that contains the attributes of the title for the column.

This setting determines the text display attributes for the column.

This property specifies the Input Method

Editor behavior.

Specifies the name of the input Method Editor.

A string list that determines the values that can be selected for the column.

This property specifies the popup ITI01U associated with this column.

Determines whether or not the data in the column can be edited.

¡Specifies a TColumnTitle object that contains the attributes of the title for the column.

A string list that determines the values that can be selected for the column.

Chapter 6—Delphi's Data-Aware Components

Chapter 6—Delphi's Data-Aware Components

Options

Figure 6.2 TColumn properties accessible through the Columns editor

Options

The Options property is a set of values that specify a wide range of behavioral and display attributes for the DBGrid control. The set can bi made up of different combinations of the elements shown in Figure 6.2 Each of the options is a Boolean value that turns on or off the various grid options.

Property dgEditing dgAlwaysShowEditor dgTitles

Purpose

The grid can be used for editing.

The grid is always prepared for editing. Must be used ir> conjunction with the dgEditin£ setting,.

If this option is included, titles are displayed at the top of the column.

dglndicator dgColumnResize dgColLins dgRowLines dgTabs dgRowSelect dgAlwaysShowSelection

This option causes a pointer to appear in the first column to indicate the current record..

This allows columns to be resized or moved.

This option causes lines to be drawn between the columns of the grid.

This option causes lines to be drawn between the rows of the grid.

This enables the Tab and Shift+Tab keys for navigation in the grid

This allows the entire row to be selected in addition to individual cells. If this option is included, dgEditing andi dgAlwaysShowEditor are ignored.

A focus rectangle is displayed on the current cell even when the focus has transferred to another control.

dgConfirmDelete dgCancelOnExit dgMultiSelect

This option causes confirmation of a deletion in the gt-id. _

This causes inserted records to which no modifications were made to be discarded when the user exits the §t-id.

This option allows multiple rows to be selected at one time.

Figure 6.3 Options values for the DBGrid component

This allows columns to be resized or moved.

This enables the Tab and Shift+Tab keys for navigation in the grid

Part II—The Delphi Database Tools

+1 0

Post a comment