Mike,
interesting reference, thanks.
I don't think it fits the description:
Gerrit Broekhuis said:
a grid with more than enough space to show all records
That compares to the first grid in my sample code where the grid has more rows and columns than the recordsource.
But to me, this raises the question of how the books' code handles that situation. As it has no chance to put the last record at the bottom grid row, because there are less records than rows, I think it would just stick and fulfill Gerrits requirement anyway.
But to me nodefault in grid.mousewheel on top of nodefault in grid.BeforeRowColchange solves the problem for Gerrit's case. I just wait for hi confirmation, but I'm sure that it works I just added it to my example, easy enough, and mousewheel scrolling also is suppressed.
At first, I only thought about scrolling by either the scrollbars - therefore remove them - and also thought by scrolling through moving in the records with the arrow keys, therefore the nodefault in BeforeRowColchange. I overlooked scrolling by mouse wheel, but that is fixed and can be made airtight with nodefault in the grid.mousewheel event. That's fixing the grid where it is. Not only for the case the rows fully fit but also if you simply want to fix the grid to the portion of data it shows.
The bonus about the 1001 Things code would be to allow scrolling in a way you'd expect it to stop when the bottom record is in the bottom grid row, whereas VFP continues until the bottom record is in the top grid row. But Gerrit's case is simply that there are fewer records than grid rows and maybe even fewer columns than the grid area could show horizontally.
In my sample, I also showcased a different scenario where the records are not fitting the grid to verify and show that the scrolling also is hindered for that extra case, where scrolling would of course still be reasonable, but nodefault in BeforeRowColchange can really hinder scrolling, not only the change of the focus to another cell, that was the reason I included it in the demo form. Simply try it out. It doesn't cover mousewheel scrolling, but nodefault in that event does and then it's a complete solution to make a non-scrollable grid.
No doubt a resonable scrolling mode, as I would call this, is better usable in the general case and would also work in Gerrits special case of less data than visible cells, too. On the other hand there is no need four counteracting too far scrolling when you don't allow it to begin with.
Chriss