unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TypInfo;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure Change(Sender: TObject);
implementation
{$R *.dfm}
procedure Change(Sender: TObject);
begin
Form1.Caption:=FormatDateTime('HH:NN:SS.ZZZ',now);
end;
procedure TForm1.FormCreate(Sender: TObject);
var I,J:Integer;
P
ointer;
M:TMethod;
begin
for I:=0 to Self.ComponentCount-1 do
if Assigned(GetPropInfo(Self.Components
,'OnChange'))
then begin
M.Code:=@Change;
M.Data:=Self.Components;
SetMethodProp(Self.Components,'OnChange',M);
end;
end;
end.