In Delphi 2010, I need to display a grid that has a horizontal scroll bar with about 15 columns x 5 rows.
I chose to use a StringGrid.
However, while the mouse button is down dragging the horizontal scroll bar, I want the grid to scroll live.
The StringGrid component, it appears, does not scroll live. It waits until the mouse button is released before updating the column and scrolling if necessary.
Also, the horizontal scroll bar button (is that what it’s called) is not proportional to the number of columns. And for a down-arrow when on the bottom row to move to the top of the next column to the right…
These seem like common needs, so I was surprised not to find them in TStringGrid.
Any suggestions on a way around these two problems? I can use a DbGrid or other standard component, but my preference is to not use a commercial grid if I can avoid it. And I’m not going to use shareware or freeware…
TIA
For the first question, you can set
goThumbTrackingin the StringGrid’sOptionsat design-time, or at run-time:For the third question, you can provide the functionality you need by using keyboard event handlers of the control. An example;
For the second question, the scrolling code seems to be buried in private methods of
TCustomGrid. I have no clue how to achieve that..