unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,stdctrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
ABU:TCB;
begin
ABU:=TCB.Create(Form1);
end;
end.
==============================
unit Unit2;
interface
uses Forms,stdCtrls,Dialogs;
type
TCB=class
public
constructor Create(AForm:TForm);
procedure MyClick(Sender: TObject);
end;
implementation
constructor TCB.Create(AForm:TForm);
var
AButton:TButton;
begin
AButton:=TButton.Create(application);
ABUtton.Parent:=AForm;
AButton.OnClick:=MyClick;
end;
procedure TCB.MyClick(Sender: TObject);
begin
showmessage('wwww');
end;
end.