Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display row number in TStringGrid?

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.

like image 897
Marcus Adams Avatar asked Jan 19 '26 11:01

Marcus Adams


1 Answers

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;
like image 71
Mike Sutton Avatar answered Jan 21 '26 01:01

Mike Sutton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!