OnGetField
Occur when TField
is requested for a cell specified by ACol
and ARow
parameters.
pas
property OnGetField: TNxGetFieldEvent read FOnGetField write FOnGetField;
If grid request Field, it first access Field property of column. Then it pass reference to this event.
If column have no Field assigned (nil), Field it may be set in-fly inside this event.
Example
pas
procedure TForm1.NextDBGrid61GetField(Sender: TObject; ACol, ARow: Integer; var Field: TField); begin if ARow = 0 then Field := DataSource1.DataSet.Fields[3]; end;
Remarks
Column doesn't need to have associated TField. Value of cell can be custom drawn, or calculated from values of other cells.