TStringGrid - is there a simple way to get the "current/selected" row?
Asked Answered
O

3

18

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?

Orchitis answered 21/1, 2010 at 7:58 Comment(1)
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.Ready
P
37

.Row for selected row, .Col for selected column

Porterfield answered 21/1, 2010 at 9:32 Comment(1)
D'oh! How on earth did I miss that??? Thanks, both. Andre answered first, so I award him the answer and up you both. If only all questions were this easy, eh?Orchitis
R
14

Please have a look at TStringGrid.Row.

Ready answered 21/1, 2010 at 7:59 Comment(0)
B
1

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

Biofeedback answered 8/6, 2022 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.