Question

How do I create a column in a TStringGrid in FireMonkey that displays the row number?

If it's by using a LiveBinding, I can't figure out how.

Was it helpful?

Solution

Your forms/grids OnGetValue event handler is passed the row as one of it's parameters. Simply verify the column is the one you want and return the row number.

function Form1.Grid1GetValue(const Row, Col: Integer): TValue;
begin
  if Col = 0 then
    Result := TValue.From<Integer>(Row);
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top