Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

StringGrid Drag selection


I have a 7 by 1 string grid in place in my application that allows users to indicate which days of the week are applicable by selecting individual cells. When a user selects a cell it toggles its colour to indicate the change.

I would like to expand this to allow users to drag the mouse over the cells they would like to select, so the stringgrid changes all cells that fall under the mouse drag motion.

Any suggestions on how I can achieve this with a TStringGrid would be great.


  • 2
1 Solution
? this does the tstringrid without any additional code

just do a try

meikl ;-)
mattlaverAuthor Commented:
Well no quite, this method only selects the first cell that the mouse was clicked on. It does not select the other cells, even though they are highlighted.

This is true when 'goRangeSelect' is set to True.

I need to capture in my program which cells have been ranged selected so I can paint them a diffrent colour.

I imagine this can be done with one of the events on the TStringList, however am unsure how to do this.
you can lookup the selection-property
in your paint-routine
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now