Skip to main content
Table of Contents

TTMSFNCCustomDataGridDatabaseAdapter Class

Base class of the database adapter. Connects a TDataSource to a data grid, maps dataset fields to grid columns, and routes reading, editing, inserting, deleting, sorting, filtering, and master-detail expansion between the grid and the dataset.

API unit family: TMSFNCDataGridDatabaseAdapter Inherits from: TTMSFNCDataGridRendererDataAdapter

Syntax

GeneratedPascalC++
TTMSFNCCustomDataGridDatabaseAdapter = class(TTMSFNCDataGridRendererDataAdapter)
class PASCALIMPLEMENTATION TTMSFNCCustomDataGridDatabaseAdapter : public TTMSFNCDataGridRendererDataAdapter

Remarks

Use the published descendant TTMSFNCDataGridDatabaseAdapter in applications. The adapter is attached to a grid through the grid's TTMSFNCCustomDataGrid.Adapter property and to data through DataSource; it has no reference to the grid of its own.

The adapter only does work while TTMSFNCDataGridDataAdapter.Active is True and the linked dataset is open (see CheckDataSet). How many records are buffered, and whether sorting, filtering, and grouping are done by the grid or passed to the dataset, is decided by LoadMode.

Properties

Name Description
ColumnAtField Returns the column mapping bound to a field name.
DataLink The data link that connects the adapter to DataSource.
FieldAtColumn Returns the dataset field bound to an adapter column.
FieldIndexAtColumn Returns the index in the dataset's Fields list of the field bound to an adapter column.
FieldNames Gets or sets the field name of the item at a given index in Columns.

Methods

Name Description
AddAllFields Binds the Columns collection to all fields of the linked dataset, in field-list order.
BeginUpdate Suspends the adapter's reactions to dataset and grid changes while several changes are made.
BlobFieldToPicture Decodes the image stored in a blob field and loads it into a bitmap.
CheckDataSet Checks whether the adapter can currently exchange data with its dataset.
ConvertDataToField Writes a cell value to a dataset field, applying OnDataToField and the default conversion.
ConvertFieldToData Converts the current value of a dataset field into a cell value, applying OnFieldToData and the default conversion.
CreateColumns Clears Columns and recreates one auto-created mapping per visible field of the open dataset, then refreshes the grid.
DataSetCanModify Checks whether the linked dataset allows changes.
DataSetCancel Cancels pending changes of the linked dataset by calling TDataSet.Cancel.
DataSetDelete Deletes the current record of the linked dataset by calling TDataSet.Delete.
DataSetDisableControls Calls TDataSet.DisableControls on the linked dataset so that all linked controls, including this grid, stop following changes.
DataSetEdit Puts the linked dataset into edit mode unless it is already editing.
DataSetEnableControls Calls TDataSet.EnableControls on the linked dataset, ending a DataSetDisableControls call.
DataSetInsert Inserts a new record at the current position of the linked dataset by calling TDataSet.Insert.
DataSetIsEditing Checks whether the linked dataset is in edit mode.
DataSetIsInserting Checks whether the linked dataset is in insert mode.
DataSetLocate Moves the linked dataset to the first record that matches the given key values.
DataSetPost Posts the record being edited in the linked dataset.
DeleteRow Deletes the dataset record shown in a grid row.
EditCell Prepares the dataset for editing the field shown in a grid cell.
EditSetData Writes the value from an in-place editor to the field shown in a grid cell.
EndUpdate Ends an update started with BeginUpdate.
GetActiveRow Returns the grid row that shows the dataset's current record.
GetGridColumnIndex Converts an adapter column index into a grid column index.
InsertRow Starts a new dataset record at the position of a grid row.
IsValidDataCell Checks whether a grid cell holds dataset data.
IsValidDataRow Checks whether a grid row represents a dataset record.
LoadAllData Reads every cell of every record once, so all values are cached in the grid's own data.
LoadValuesFromField Fills a list with the value of a field for every record of its dataset.
ReloadFromDataSet Reloads the grid from the linked dataset.
RemoveAllColumns Removes all column mappings and clears the grid, setting its row and column counts to 0.
RemoveAllFields Clears the field binding of every item in Columns while keeping the items and grid columns.
ResetActiveRecord Restores the data link's active record saved by the last SetActiveRecord call.
SelectCell Moves the dataset to the record of a selected grid cell.
SetActiveRecord Makes the buffered record of a grid row the data link's active record, so field values can be read for that row.
Update Resynchronizes the grid with the dataset position and repaints the data.