Sign in Join
FPDoc Onlineexperiment

TCustomDBGrid.GetTruncCellHintText function

Member of TCustomDBGridprotectedIn unit DBGrids

Gets the truncated hint text for the specified cell.

Declaration

pascal
function GetTruncCellHintText(aCol: Integer; aRow: Integer): string
 ; override

Arguments

aCol

Column number for the cell hint text.

aRow

Row number for the cell hint text.

Function result

Contains the hint text for the cell derived in the method.

Description

GetTruncCellHintText is an overridden method in TCustomDBGrid. It re-implements the method from the ancestor class, and does not call the inherited method.

GetTruncCellHintText is used to get the truncated hint text (shortened with an Ellipsis appended) for the cell specified in the ACol and ARow arguments. No actions are performed in the method if ARow is one of the FixedRows for the grid control; the return value is an empty string ('') in this situation.

GetTruncCellHintText calls GetFieldFromGridColumn to get the TField instance which provides the data for the column in ACol. The DataType for the TField instance determines the content stored in the return value. For example:

ftMemo
Uses the field value in the cell hint text when dgDisplayMemoText has been included in the Options property.
ftBlob
Causes the value '(blob)' to be used in the cell hint text.

Other values in DataType cause the DisplayText for the field to be be used as the cell hint text.

The cell hint text is an empty string ('') if a field type was not found for the specified column number, or field data for the cell contains an unassigned or NULL value (TField.IsNull returns True). This is also the cell hint returned when the dataset for the grid is empty.

The OnGetCellHint event handler is signalled (when assigned) if CellHintPriority is set to chpTruncOnly. This allows the TColumn instance for the cell to be used to override the value for the cell hint text or to truncate the value to a specific length.

GetTruncCellHintText is called from the ShowCellHintWindow method in the ancestor class.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.