Creating a Grid That Contains Other Data-aware Controls

From RAD Studio
Jump to: navigation, search

Go Up to Using data controls Index


A Vcl.DBCGrids.TDBCtrlGrid control displays multiple fields in multiple records in a tabular grid format. Each cell in a grid displays multiple fields from a single row.

To use a database control grid

  1. Place a database control grid on a form.
  2. Set the DataSource property of the grid to the name of a data source.
  3. Place individual data controls within the design cell for the grid. The design cell for the grid is the top or leftmost cell in the grid, and is the only cell into which you can place other controls.
  4. Set the DataField property for each data control to the name of a field. The data source for these data controls is already set to the data source of the database control grid.
  5. Arrange the controls within the cell as desired.

When you compile and run an application containing a database control grid, the arrangement of data controls you set in the design cell at run time is replicated in each cell of the grid. Each cell displays a different record in a dataset.

D32recgd.jpg

The following table summarizes some of the unique properties for database control grids that you can set at design time:

Selected database control grid properties :

Property Purpose

AllowDelete

True (default): Permits record deletion.False: Prevents record deletion.

AllowInsert

True (default): Permits record insertion.False: Prevents record insertion.

ColCount

Sets the number of columns in the grid. Default = 1.

Orientation

goVertical (default): Display records from top to bottom.goHorizontal: Displays records from left to right.

PanelHeight

Sets the height for an individual panel. Default = 72.

PanelWidth

Sets the width for an individual panel. Default = 200.

RowCount

Sets the number of panels to display. Default = 3.

ShowFocus

True (default): Displays a focus rectangle around the current record's panel at run time.False: Does not display a focus rectangle.



See Also