Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Preserve current row

 Post Reply Post Reply
Author
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Topic: Preserve current row
    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!
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8235
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post 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;

Back to Top
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 2019 at 7:05pm
Works as I want, however I do read/set the TopRow, too.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3365
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down