How to restore TDBGrid record view to state before upgrade?

Possible duplicate:
Avoiding TDbgrid scrolling when returning to a previous location

I am looking for a way to save and restore the vertical scroll position of Delphi TDBGridafter the update. Currently, the grid is reset, so the selected record is displayed in the middle of the list of records.

First, the properties LeftColand TopRowwere a solution, but it works only LeftCol. The value is TopRowalways 1 and never changes. This appears to be a position in the internal grid write buffer, which is set to the number of lines displayed in the grid. That is, it seems that FBuffers glides up and down, but TopRowalways remains 1.

A detailed example of what I see is:

  • The grid displays 11 records TClientDataSet, starting from record 5, showing sequentially record 15.
  • The selected record cursor is on record 15 (the last record in the view).
  • The dataset is updated through TDataSetProviderassociated with TADODataSet. (Call .Open or .Refresh).
  • The dataset.Locate method is used to save the actual selected record in the face of inserts / exceptions.
  • The grid changes so that record 15 is in the center and displays records 10 to 20.

Is there anything that can be saved / restored / executed so that the grid can be restored to the original view configuration, displaying records 5-15 with the cursor on the same selected record, wherever it appears?

, , - , Delphi 3.0 TopRow, LeftCol, : http://www.delphigroups.info/2/79/314206.html

DBGrids.pas .

+5
1
+6

All Articles