Delphi TStringGrid multi select, determining selected rows
13,080
Solution 1
I guess you are talking about a range-select string grid, that is, a string grid with goRangeSelect
in Options
. Then you can use the Selection
property. This is (essentially) a TRect
in which you can find the upper-left and lower-right cell in the range selection.
Solution 2
Oooh, I'm use StringGrid.Selection.BottomRight.Y
to determine rows and StringGrid.Selection.BottomRight.X
for columns.
Author by
sse
Updated on June 05, 2022Comments
-
sse almost 2 years
Is there anyway to determine which rows are currently selected in a multi-select
TStringGrid
, or aTCustomGrid
for that matter. A property would be ideal.I know that there is the
gdSelected
property that gets set in theDrawCell
event,procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState);
I can check
AState
forgdSelected
, and keep track of this in an array somewhere, but this seems kludgey.