unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Timer1: TTimer;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
RichEdit1: TRichEdit;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
FControl: TWinControl;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FControl :=
nil;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var CurrControl: TWinControl;
begin
Timer1.Enabled := false;
CurrControl := FindVCLWindow(Mouse.CursorPos);
if Assigned(CurrControl)
and (CurrControl <> FControl)
and CurrControl.CanFocus
then
begin
CurrControl.SetFocus;
FControl := CurrControl;
end;
Timer1.Enabled := true;
end;
end.