AndrewMozley
Programmer
I am revisiting some old forms ! and am uncertain about how the data is positioned in a grid when new records may be being added to its recordsource.
There is a grid, grdmain which allows the user to enter data into its recordsource, cursor tdetail.
Intially there are two blank records in tdetail. Tdetail is positioned at its first record, so the active cell is on the top LH of the grid, corresponding to tdetail.tdesc (a 30 character description field). When the user keys “Desc1” on the screen and presses the Dnarrow key, several events occur, including grdmain.AfterRowColChange(). This checks whether we are now on the last record of tdetail. If we are, my code appends a record to tdetail, so that (if the user navigates down again) there is a record to go to.
This works fine, so the screen now has focus on line 2 of the visible grid, with the preceding line visible and a spare line to navigate to – if required. There are 7 visible lines (but there could be more - the form can be re-sized)
But after entering line 4, and adding a new record to cursor tdetail the grid scrolls up, so lines 2-4 are shown (with contents Desc1, Desc2 &c displayed. And the blank line is just below the current active row.
That is fine and the user can continue entering data, or scroll back up the grid to edit any of the preceding lines (the grid may scroll as necessary. I think that rhis is the standard behaviour for a grid - don’t believe that my grid class is causing this useful scrolling.
But sometimes the user might prefer (after entering each line and pressing DnArrow) that the grid should not scroll, so that he can see all the preceding lines - at least until there are too many to fit in the visible grid.
Is there a way that I can specify where the data is positioned vertically positioned on the grid (and possibly inhibit the automatic scrolling)? And how can I determine how may rows of the grid are visible on the screen?
Thank you.