Print Page | Close Window

Preserve current row

Printed From: TMS Software
Category: FNC Components
Forum Name: FNC UI Pack
Forum Discription:
URL: http://www.tmssoftware.com/site/forum/forum_posts.asp?TID=14053
Printed Date: 06 Dec 2019 at 6:37pm


Topic: Preserve current row
Posted By: Maierhofer Bernd
Subject: Preserve current row
Date Posted: 14 Oct 2019 at 10:16pm
I want to reload the content of my grid and to preserve the current row. Something like:

nRow:=Grid.CurrentRow;
?.
Grid.CurrentRow:=nRow;

How can I do this?

Thanks!



Replies:
Posted By: Bruno Fierens
Date Posted: 14 Oct 2019 at 11:17pm
You can get the selected row with:
  sr := TMSFNCGrid1.Selection.StartRow;

You can restore the selected row with:
var
  cr: TTMSFNCGridCellRec;
begin
  cr.Col := 1;
  cr.Row := sr;
  TMSFNCGrid1.SelectCell(cr);
end;



Posted By: Maierhofer Bernd
Date Posted: 15 Oct 2019 at 7:05pm
Works as I want, however I do read/set the TopRow, too.


Posted By: Pieter Scheldeman
Date Posted: 16 Oct 2019 at 10:27am
The selected row persistence is for keeping the current row, the TopRow is for scrolling to a certain row. Both can be used to preserve the view/selection state of the grid.



Print Page | Close Window