17

I can go the long way round, loop over each row, get a TRect from CellRect(col, row), then query its State for gdSelected ...

But isn't there a quicker way to get the row number of the currently selected row, if any?

Johan
  • 74,508
  • 24
  • 191
  • 319
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • 2
    Note that your variable names are unfortunate, as they hide properties of the grid. For loop variables you should probably use something like `RowIndex` and `ColIndex` to avoid the problem. – mghie Jan 21 '10 at 08:07

3 Answers3

37

.Row for selected row, .Col for selected column

André
  • 8,920
  • 1
  • 24
  • 24
14

Please have a look at TStringGrid.Row.

mghie
  • 32,028
  • 6
  • 87
  • 129
1

With FMX, I'm using StringGrid1.Selected, but I changed property >> Options > RowSelect = true