三个小问题?请速!

wangzn1979 2003-02-08 03:15:24
1.如何判断在5分钟之内没有任何输入消息(就象屏幕保护程序一样)
2.在DBGrid中,如何使得焦点行不随滚动条的变化而变化?
3.离开DBGrid后,如何保持高亮显示的行继续高亮显示?

谢谢大家
...全文
38 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangzn1979 2003-02-09
  • 打赏
  • 举报
回复
to 版主:
你说的方法不行啊!
对于一个主窗体,然后生成一个子窗体!对子窗体进行操作时,应该不触发的,但是触发了!该怎么办呢?
wangzn1979 2003-02-09
  • 打赏
  • 举报
回复
3 解决拉!
设置:dbAlwaysShowSelection:=True
就可以拉!

第2个请大家解决
wangzn1979 2003-02-08
  • 打赏
  • 举报
回复
看的不是太懂!能加点注释吗?版主

其余的问题真的需要自己写吗?
Billy_Chen28 2003-02-08
  • 打赏
  • 举报
回复
问题太多,分数太少,先回答一个:


修改Timer控件,继承下来:
用法:
if IdleTimer1.Snooze>8000 then ShowMessage('用户已经有8秒钟没输入数据了哈!');
///FileName:IdleTimer.Pas
unit IdleTimer;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;

type
TIdleTimer = class(TTimer)
private
function GetSnooze: Longint;
procedure SetSnooze(const Value: Longint);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
property Snooze:Longint read GetSnooze write SetSnooze;
published
{ Published declarations }
end;

procedure Register;

implementation

var
Instances:integer;
ElapsedTime:Longint;
whKeyBoard,whMouse:HHook;

procedure Register;
begin
RegisterComponents('System', [TIdleTimer]);
end;

{ TIdleTimer }

function MouseHookCallBack(Code:integer;Msg:lParam;MouseHook:wParam):DWORD;stdcall;
begin
if Code>=0 then ElapsedTime :=GetTickCount;
Result := CallNextHookEx(whMouse,Code,Msg,MouseHook);
end;

function KeyBoardCallBack(Code:integer;Msg:word;KeyBoardHook:Longint):LongInt;stdcall;
begin
if Code>=0 then ElapsedTime :=GetTickCount;
Result := CallNextHookEx(whKeyBoard,Code,Msg,KeyBoardHook);
end;

constructor TIdleTimer.Create(AOwner: TComponent);
function GetModuleHandleFromInstance:THandle;
var
s:array[0..512] of char;
begin
GetModuleFileName(HInstance,s,SizeOf(s)-1);
Result :=GetModuleHandle(s);
end;

begin
inherited Create(AOwner);
Inc(Instances);
if Instances =1 then begin
ElapsedTime :=GetTickCount;
whMouse := SetWindowsHookEx(WH_MOUSE,@MouseHookCallback,GetModuleHandleFromInstance,0);
whKeyBoard :=SetWindowsHookEx(WH_KEYBOARD,@KeyBoardCallBack,GetModuleHandleFromInstance,0);
end;
end;

destructor TIdleTimer.Destroy;
begin
Dec(Instances);
if Instances =0 then begin
UnhookWindowsHookEx(whKeyBoard);
UnhookWindowsHookEx(whMouse);
end;
inherited;
end;

function TIdleTimer.GetSnooze: Longint;
begin
Result:= GetTickCount - ElapsedTime;
end;

procedure TIdleTimer.SetSnooze(const Value: Longint);
begin
ElapsedTime := GetTickCount + Value;
end;
china_lyz 2003-02-08
  • 打赏
  • 举报
回复
1.作任何输入的时候记载下来,到5分钟看是否有记录
2。3需要自己写DBRID来实现

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧