Data-Aware Grids to display and operate on information held in a database
EInvalidGridOperation
- exception class for invalid grid operatins
TCustomDBGrid
- the Base class for TDBGrid, a data-aware component for displaying information from a database in the manner of a Stringrid
HowToUseDataAwareControls HowToUseGrids
TColumn
- one of the physical columns of the display in a DataBase Grid (not necessarily the same as a Column in a SQL database)

TColumn - one of the physical columns of the display in a DataBase Grid

Each column may display the information held in a Field of the DataSet to which the DBGrid is attached, but the order of appearance of the columns need not correspond to the order in which the Fields exist in the DataSet, nor need all Fields be represented by a Column.

TDataSetScrolledEvent
- generic method for handling scrolling events in a DataSet
TDBGridClickEvent
- generic event handling method for a click in the specified column of a DataBase Grid
TMovedEvent
- generic event handler method for moving between FromIndex and ToIndex in a DataBase Grid
TDrawColumnCellEvent
- generic event handler method for drawing a cell in a specified column in a DataBase Grid
TGetDbEditMaskEvent
- generic event handler method for obtaining an Edit Mask in a DataBase Grid
TDBGridOption
- enumerated type, containing options available for a DataBase Grid
TDbGridExtraOption
- some extra options available for DataBase Grids
TDbGridExtraOptions
- set of TDbGridExtraOption
TDbGridOptions
- set of TDbGridOption
TDbGridStatusItem
- enumerated type containing items available for defining DataBase Grid status
TDbGridStatus
set of TDbGridStatusItem
TDbGridSelEditorEvent
- generic event handling method for selecting an Editor for a DataBase Grid
TPrepareDbGridCanvasEvent
- generic event handling method for preparing the Canvas for a DataBase Grid
TBookmarkList
- a list of Bookmarks in a DataBase Grid
Create
- constructor for TBookmarkList: calls inherited Create, attaches Grid and initialises list
TObject.Create
Destroy
- destructor for TBookmarkList: clears and frees the list then calls inherited Destroy
TObject.Destroy
Clear
the list of Bookmarks
Delete
the Bookmarks from the list one by one
Find
the nominated Bookmark string, returning its index; result (boolean) is True if successful
IndexOf
- returns the index of the nominated Bookmark string
Refresh
- searches for any invalid Bookmarks, which it removes: returns True if the action was successful
Count
- the number of Bookmarks in the list
CurrentRowSelected
- True if the current row is selected
Items
- the list of Bookmarks as an indexed array of strings
TColumnOrder
- enumerated type defining alternative ordering methods for the columns

TColumnOrder - enumerated type defining alternative ordering methods for the columns

Can be design order, or ordered by field index

TComponentDataLink
- forms a link between a component and a DataSet and contains event handlers to operate on the records
RecordChanged
- calls the OnRecordChanged event handler if it has been assigned
TDataLink.RecordChanged
DataSetChanged
- calls the OnDataSetChanged event handler if it has been assigned
TDataLink.DataSetChanged
ActiveChanged
- if there has been a change in the Active status, calls the appropriate event handler for the change

ActiveChanged - if there has been a change in the Active status, calls the appropriate event handler for the change

May call one of the following:

- OnNewDataSet
- OnDataSetOpen
- OnInvalidDataSet
- OnDataSetClosed

TDataLink.ActiveChanged
LayoutChanged
- calls the OnLayoutChanged event handler if it is assigned
TDataLink.LayoutChanged
DataSetScrolled
- calls the OnDataSetScrolled event handler if it is assigned
TDataLink.DataSetScrolled
EditingChanged
- calls OnEditingChanged if it is assigned
TDataLink.EditingChanged
UpdateData
- calls OnUpdataData event handler if it is assigned
TDataLink.UpdateData
Modified
- True if the data have been modified
OnRecordChanged
- event handler for a change in the current record
OnDataSetChanged
- event handler for a change in the attached Data Set
OnNewDataSet
- event handler for formation of a link to a new data set
OnDataSetOpen
- event handler when the data set is open
OnInvalidDataSet
- event handler when the data set is non-valid
OnInvalidDataSource
- event handler when the data source is non-valid
OnLayoutChanged
- event handler when the layout of the data set has changed
OnDataSetClose
- event handler when the data set is closed
OnDataSetScrolled
- event handler when the data set is scrolled
OnEditingChanged
- event handler for a change in the Editing property
OnUpdateData
- event handler for implementing any pending changes to data
DataSetName
- the (string) name of the attached data set
Fields
- an indexed array containing the fields of the dataset
TColumnTitle
- class of TGridColumnTitle
TColumn
- one of the physical columns of the display in a DataBase Grid (not necessarily the same as a Column in a SQL database)

TColumn - one of the physical columns of the display in a DataBase Grid

Each column may display the information held in a Field of the DataSet to which the DBGrid is attached, but the order of appearance of the columns need not correspond to the order in which the Fields exist in the DataSet, nor need all Fields be represented by a Column.

Find which field's data is to be displayed in this column
GetPickList
- calls inherited GetPickList, then if there are additional items, adds them before returning
TGridColumn.GetPickList
Find which DataSet is to be used
GetDefaultReadOnly
- if a grid or field have been assigned, gets the default readonly property from the link, otherwise calls inherited GetDefaultReadOnly
TGridColumn.GetDefaultReadOnly
GetDefaultWidth
- looks to see if a grid with canvas has been allocated, and gets width from there, otherwise uses global defaut width
TGridColumn.GetDefaultWidth
GetDisplayName
- if a field has been assigned, return the name of the field otherwise calls inherited GetDisplayName
TCollectionItem.GetDisplayName
LinkField
- if the data link is Active, form the link with this feild
Create
- constructor for TColumn: calls inherited Create and sets a design index of appropriate size
Create
instantiates a new item in a TCollection. It is called by the TCollection.Add function and should under normal circumstances never be called directly.
TGridColumn.Create
Destroys this collection item.

Destroy removes the item from the managing collection and Destroys the item instance.

This is the only way to remove items from a collection;

The Field in the DataSet that is to be associated with this Column, for display , editinig etc
Refers to the whole entity Field, including contents, name, position in the dataset, properties such as read/write enabling etc
Assign
- if the Source is a Grid, copies relevant values across, otherwise calls inherited Assign
TPersistent.Assign
GetDefaultAlignment
- returns the supplied alignment if valid, otherwise returns the inherited default
TGridColumn.GetDefaultAlignment
GetDefaultDisplayFormat
- returns a string containing the default format for display
GetDefaultValueChecked
- if the value of the checked item is boolean, returns the boolean expressed as a string
TGridColumn.GetDefaultValueChecked
GetDefaultValueUnchecked
- if the value of the unchecked item is boolean, returns the boolean expressed as a string
TGridColumn.GetDefaultValueUnchecked
IsAutomaticColumn
- if True, this is an automatic column
IsDesignColumn
- if True, this is a design column
DesignIndex
- the likely maximum index value
The format to be used for display in this column
The name of the field (as a string), as returned from the dataset
TDBGridColumns
- the columns of data found in a Database Grid
Update
- calls LayoutChanged if updates required
TCollection.Update
ColumnFromField
- returns the column identity corresponding to the given field
Add
- first removes any autocolumns, then calls inherited Add
TCollection.Add
LinkFields
- links all the fields to the corresponding items in the list of columns
Items
- the indexed array of Columns that hold the data in the Grid
HasAutomaticColumns
- checks through the list of columns, and if any one IsAutomaticColumn, returns True
HasDesignColumns
- checks through the list of columns, and if any one IsDesignColumn, returns True
RemoveAutoColumns
- goes through the list of columns and removes any that are automatic

RemoveAutoColumns - goes through the list of columns and removes any that are automatic

Only does this if HasAutomaticColumns is True

ResetColumnsOrder
if coDesignOrder has been specified, rearrange the columns in the specified order
TCustomDBGrid
- the base class for TDBGrid , for displaying database information in the manner of a StringGrid
HowToUseDataAwareControls HowToUseGrids
UpdateData
- implements any pending changes in the data: uses a method appropriate to the data type of the field
GetDsFieldFromGridColumn
- returns the identity of the DataSet field corresponding to the nominated grid column
GetFieldFromGridColumn
obtain the field either from a Db column or directly from dataset fields
GetGridColumnFromField
- obtain the corresponding grid column for the given field
FieldIndexFromGridColumn
returns the index for the database field corresponding to the stated grid column
BeginLayout
starts producing the layout for the grid
CellClick
- calls the OnCellClickevent handler if it is assigned for this particular cell
CreateWnd
- creates the window: calls inherited CreateWnd and adjusts layout if needed, in particular putting in scrollbars
TWinControl.CreateWnd
DefaultDrawCell
- the default method for drawing a cell at the specified location, depending on the type of cell
DoExit
- closes down data links and calls inherited DoExit
TWinControl.DoExit
DoOnChangeBounds
- calls inherited DoOnChangeBounds, adjusts layout if required
TControl.DoOnChangeBounds
EditingColumn
- the Ok status is true if the data are being modified over the link
EditorCancelEditing
- cancels changes and disables editing processes
EditorDoGetValue
- calls inherited EditorDoGetValue and performs UpdateData
TCustomGrid.EditordoGetValue
EditorCanAcceptKey
checks the integrity of the datalink and that the key and field are valid character entities
TCustomGrid.EditorCanAcceptKey
EndLayout
- finishes modifying layout
GetEditMask
- checks datalink, finds field value and calls OnFieldEditMask if it is assigned
TCustomGrid.GetEditMask
GetEditText
- checks the datalink, finds field and loads its text
GridCanModify
returns True if datalink is active and allows editing, and readonly is not set
HeaderClick
- calls OnHeaderClick if assigned
TCustomGrid.HeaderClick
KeyDown
- checks key for a number of special cases, and calls the OnKeyDown event handler if assigned, otherwise calls inherited KeyDown
LinkActive
- if False, calls RemoveAutomaticColumns and LayoutChanged
LayoutChanged
- links columns to fields, inserts any required automatic columns
MoveSelection
- calls inherited MoveSelection and updates the Active state
TCustomGrid.MoveSelection
MouseDown
- checks for a number of special cases and calls the OnMouseDown event handler, or calls inherited MouseDown
UpdateActive
- updates the Active status for the field and record
UpdateGridCounts
- modifies the total sizes allowing for any pending changes
The DataSource from which this grid displays - usually the result of a database Query
Set True to prevent writing to grid; set False to allow modification
Event handler for mouse click in a cell of the grid
Event handler if mouse enters column or it gains focus
Event handler if mouse leaves column or it loses focus
OnColumnMoved
- event handler for moving a column
Event handler if the cell in this column requires to be drawn
Event handler if field is associated with an edit mask
Event handler for mouse click on Title
Create
- constructor for TCustomDBGrid: calls inherited Create then sets up datalink events, options and defaults
TCustomGrid.Create
DefaultDrawColumnCell
- the default method for drawing cells in this column
TCustomGrid.Destroy
Destroy
- destructor for TCustomDbGrid: frees rows, frees the datalink, calls inherited Destroy
The selected field, for editing, data input or simply viewing
AddAutomaticColumns
add as many columns as there are fields in the dataset; do this only at runtime.
InvalidateSizes
renders the Sizes non-valid
ColumnEditorStyle
- returns a button style appropriate to the kind of column being edited
DoMouseWheelDown
- calls the OnMouseWheelDown event handler if assigned, and adjusts position of pointer over the link
TControl.DoMouseWheelDown
DoMouseWheelUp
- calls the OnMouseWheelUp event handler if assigned, and adjusts position of pointer over the link
DoPrepareCanvas
- calls the OnPrepareCanvas event handler if assigned
TCustomGrid.DoPrepareCanvas
DrawCheckboxBitmaps
calls DrawGridCheckboxBitmaps after checking that datatype of relevant cell is boolean
DrawFixedText
draws the text in a fixed row
GetBufferCount
- returns the size of the buffer
GetDefaultColumnAlignment
- gets a default alignment from the stated column if it has one, otherwise supplies a default LeftJustify alignment
GetDefaultColumnWidth
- calls DefaultFieldColWidth (private function)
GetDefaultColumnReadOnly
- finds default ReadOnly status for column from data link
GetDefaultColumnTitle
- returns the display name from the nominated grid column
GetDefaultRowHeight
calls inherited GetDefaultRowHeight and makes it a little smaller
TCustomGrid.GetDefaultRowHeight
RemoveAutomaticColumns
- strips out any automatic columns from the grid
GridStatus
- the status of the grid (whether updating, removing auto columns etc)
OptionsExtra
- the extra options for this grid
OptionsExtra
- the extra options for this grid: autocolumns and enable checkboxes
SelectedRows
- recorded as a bookmark list
OnColumnSized
- event handler for re-sizing a column
OnPrepareCanvas
- event handler for preparing canvas
OnSelectEditor
- event handler for selecting editor
OnUserCheckboxBitmap
- event handler: user-defined bitmap for checkboxes

OnUserCheckboxBitmap - event handler: user-defined bitmap for checkboxes

The user is encouraged to provide bitmaps to represent the three states for database grid checkboxes: gcbpUnChecked, gcbpChecked and gcbpGrayed

Initiate the action associated with this control
ResetColWidths
- restore the column widths to their default values
Selected index - number of the row selected for viewing or editing
The selected column for viewing or editing
Columns and fields are often used interchangeably, but their properties are different.
ThumbTracking
- returns True if thumb tracking is used
TdbGrid
- a data-aware version of TStringGrid, for displaying and operating on a series of Rows and Columns from a database

TdbGrid - a data-aware version of TStringGrid, for displaying and operating on a series of Rows and Columns from a database

Inherits many of its properties from TCustomGrid and, of course, from TCustomDBGrid

HowToUseDataAwareControls HowToUseGrids
The Canvas is the area of screen on which the various components are drawn.
This inherits its properties from TCanvas,
and that description should be read to understand their definitions more fully.

// standard properties, which should be supported by all descendants

Either reads a flag containing alignment instructions (FAlign) or writes alignment instructions (SetAlign)

May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

Only a restricted series of options is available: none or a single border.

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

Refers to the physical columns of the grid, displaying the contents of the relevant Fields

The Columns property is configurable from the Object Inspector by selecting the ellipsis (...) next to the property name, in which case a pop-up memo box appears to allow editing. It deals with things like the size, shape and format of the display, and contains a link to the appropriate Field.

Do no confuse Grid columns (in the display) with the SQL usage of COLUMNS, which corresponds to Fields in our environment. The Fields consist of a series of cells arranged in Records, which contain the actual data which are to be displayed and operated upon.

It is entirely possible that not all fields of the dataset are displayed, and so fields do not correspond directly to columns; in fact the Columns property allows the user to configure which data field is to be displayed in each column

// standard properties, which should be supported by all descendants

Determine Constraints (max and min height and width) for this control; reads the size constraints or stores new ones.

If new rows of the grid are created by changing the RowCount property, the height of these new rows will be set to the value of the DefaultRowHeight property.

After that the user may redefine this value. If the Options property includes the appropriate value, the row height may also be changed by the user at runtime.

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

The color used by headings.
// standard properties, which should be supported by all descendants
Reads the details of the pop-up menu, or stores them.
Properties are defined in the parent class TPopupMenu
// standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
Reads or writes information in flag; default is -1

Reads or writes boolean flag; default is False

Use the TabStop to allow or disallow access to the control using the Tab key.

If TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't use the Tab key to move to the control.

Visible
- can the control be seen?

    The Visible property represents the ability to see a visual control.
              If Visible is True the control is shown, otherwise it is hidden.
              Calling Show sets, among others, Visible to True.
              Setting Visible to False is equivalent to calling Hide method.

The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.

Double-clicking is much more common in a Windows environment than in Unix or Linux, where single-clicking is the default method for selecting an object. However, in all environments there could be valid use for a double-click, and a method should be supplied if appropriate.

OnKeyDown - event handler for instance when key is down while control has focus

Differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

OnKeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

The key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

TBMStringList
- a special StringList for BookMarks in a DataBase Grid
IsValidChar
- returns True if the supplied field contains a valid ASCII or UTF8 character