Question

I need a string grid which can scroll smoothly, as opposed to locking in the top row / left col positions. When you scroll a TStringGrid, the left visible column and top visible row snap into position along the top/left edges. I need the ability for the user to scroll smoothly, not locking these edges into place.

I wouldn't think this is possible to modify in the VCL TStringGrid (or TCustomGrid for that matter) because it relies on properties such as TopRow, LeftCol, VisibleRowCount, etc.. I'm pretty sure I'll need a third party control, but I'd love to use the TStringGrid if possible, because I already have a lot of code wrapped around it. If I do need a third-party grid, then I'm hoping it works closely enough like the TStringGrid.

Was it helpful?

Solution

The short answer is no, you can´t pixel scroll a TStringGrid. You can simulate a grid using a TScrollBox. You can put a grid inside the TScrollBox, make the grid large enough to fit all rows and cols, and turn off its scroll bars, but some things like keyboard navigation will not work.

Other alternative is to use the TVirtualTree in grid mode or TListView. Both have this pixel scroll you want.

OTHER TIPS

I was looking for something similar. Unfortunately, you can't do it with Borland's code but Lazarus can do it Scrolling the TStringGrid pixel by pixel
You may want to take a look in their code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top