当你刷新当前Table时,刷新后如何回到你上一次所在位置呢?
第一:
在你刷新前保存所在位置的行號
procedure XXXClass.LockPositionEx;
begin
DisableControls;
FHistoryRecNo := 0;
FHistoryIndexName := EmptyStr;
if Active then
begin
if IndexName <> EmptyStr then
FHistoryIndexName := IndexName;
IndexName := EmptyStr;
if not IsEmpty then
if (State in [dsEdit,dsInsert]) then
FHistoryRecNo := -1
else
FHistoryRecNo := RecNo;
end;
end;
第二刷新后定位到新行號
procedure XXXClass.UnlockPositionEx;
begin
if Active then
begin
if not IsEmpty then
if FHistoryRecNo < 0 then//處理編輯狀態,直接跳至最后一條記錄
Last
else if FHistoryRecNo = 0 then
First
else if FHistoryRecNo > 0 then//
begin
if RecordCount >= FHistoryRecNo then
RecNo := FHistoryRecNo
else if RecordCount > 0 then
Last;
end;
if FHistoryIndexName <> EmptyStr then
begin
IndexName := FHistoryIndexName;
FHistoryIndexName := EmptyStr;
end;
end;
EnableControls;
end;
?
轉載于:https://www.cnblogs.com/Morlin-julier/p/5038627.html
總結
以上是生活随笔為你收集整理的当你刷新当前Table时,刷新后如何回到你上一次所在位置呢?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 获取用户真实Ip地址
- 下一篇: JSP入门实战下