设为首页 加入收藏

TOP

当你刷新当前Table时,刷新后如何回到你上一次所在位置呢?
2017-10-10 12:07:31 】 浏览:4598
Tags:刷新 当前 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;

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇[教学] Firemonkey TImageList 加.. 下一篇【Asphyre引擎】Asphyre时隔3年,..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目