1 2 //this sample show how to deturmin if a object has an event assigned to it.3 unit Unit1;
4 5 interface6 7 uses8 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
9 Dialogs, StdCtrls;
10 11 type12 TForm1 = class(TForm)
13 Button1: TButton;
14 procedure Button1Click(Sender: TObject);
15 private16 { Private declarations }17 public18 { Public declarations }19 end;
20 21 var22 Form1: TForm1;
23 24 implementation25 26 {$R *.dfm}27 28 procedure TForm1.Button1Click(Sender: TObject);
29 begin30 31 if addr(Button1.onclick)<>nilthen//use addr to find addresss of onClick event32 showmessage('This Button has a OnClick an event assigned to it')
33 else34 showmessage('This Button do not have a OnClick an event assigned to it');
35 36 if addr(Button1.onExit)<>nilthen//use addr to find addresss of onExit event37 showmessage('This Button has a OnExit an event assigned to it')
38 else39 showmessage('This Button do not have a OnExit an event assigned to it')
40 41 end;
42 43 end.