Can someone explain the .Find method?
I want to find a value in a hidden column and automatically scroll to and select that row.
(In this case it's the last column of the grid)
The grid is already configured as gsmSingleRow.
I have this code, but it finds the same value in cell in a different column and selects that row.
// Searches for a value and selects the corresponding row
procedure LookupAndSelect(AGrid: TTMSFNCDataGrid; AColumn: Integer; AValue: string; FocusGrid: Boolean = false);
var
r: Integer;
c: TTMSFNCDataGridCellCoord;
fparams : TTMSFNCDataGridDataFindParameters;
begin
AGrid.BeginUpdate;
try
// Look up the value and select the row
fparams := [gfnAutoGoto, gfnIncludeHiddenColumns, gfnIncludeHiddenRows, gfnFindInPresetColumn];
c := AGrid.Find(AValue, fparams);
r := AGrid.RealToDisplayCell(c).Row;
if r > 0 then
AGrid.SelectedRows[r] := true;
finally
AGrid.EndUpdate;
end;
// Optionally focus the grid after selection
if FocusGrid then
AGrid.SetFocus;
end;