三个小问题?请速!

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

谢谢大家
...全文
7 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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来实现
回复
发帖
数据库相关
创建于2007-08-02

2451

社区成员

Delphi 数据库相关
申请成为版主
帖子事件
创建了帖子
2003-02-08 03:15
社区公告
暂无公告