TStringGrid with BOTH editing AND range selection?

Posted by Kevin Killion on Stack Overflow See other posts from Stack Overflow or by Kevin Killion
Published on 2010-05-18T20:43:13Z Indexed on 2010/05/19 2:10 UTC
Read the original article Hit count: 274

Filed under:
|
|

Question:

Can anyone point to an article or code samples anywhere on how to provide BOTH editing AND range selection in a TStringGrid?

Yes, I KNOW there are third-party grids that do this, but it's frustrating that the built-in grid lacks this basic capability.

Background:

It's pretty normal to expect to be able to both edit a cell in a grid, and also to select a range of cells such as for a Copy operation.

As delivered, TStringGrid doesn't do that. It's either/or. In fact, the docs tell us about the grid Options, "When goEditing is included in Options, goRangeSelect has no effect".

However, it looks like it may be possible to do editing and rangeselects in a TStringGrid anyway!!! Through careful use of the mousedown, mouseup, selectcell and exit events, you can get dang close by switching editing elements on and off at the right times. But I still don't have it perfect, and that only covers mouse use, not keyboard changes.

© Stack Overflow or respective owner

Related posts about tstringgrid

Related posts about delphi