How to allow the user to select multiple cells of a TStringGrid object?Additionally, is there a way to select multiple cells of TStringGrid object using some code?(but these cells should be seen in the gui as highlighted cells)
If you hold down the shift key as you click a cell on a TStringGrid
component it will select multiple adjacent cells in the rectangle formed
by the cell you have clicked with the shift key down and the cell you
previously did a click on.
Tested with VCL. I think the same applies to FMX grid.
Hope this helps, Regards, Roger
That's interesting: just tried Firemonkey and the TStringGrid behaves differently.
Does anyone know how to select multiple fields on TStringGrid on firemonkey?
You could of course write your own code to handle clicks and to draw "selected
cells" (that your code would have to keep track of) using the OnDrawCell event,
but this could become quite involved....
Thanks for your answer Roger Cigol. Now I am working on OnDrawColumnCell event( actually I couldn't find OnDrawCell(which you suggested) event under events tab under TStringGrid object, there is OnDrawColumnCell event, did you mean that?). I think I will be able to do what I am trying to do by using OnDrawColumnCell event but if I can't do it I will post another question here.
I think TSringGrid object should have this property built-in inside Firemonkey.
In VCL the event is OnDrawCell and is fired for all cells in the string grid.
In FMX the event is OnDrawColumnCell and is fired only for non-column header cells.
(and there is another event: OnDrawColumnHeader that is fired for the column headings).