unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure MyClick(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.MyClick;
begin
ShowMessage('Hello!')
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
with TButton.Create(Self) do
begin
Parent:=Self;
Left:=1;
Top:=1;
Caption:='Click me!';
OnClick:=Form1.MyClick
end
end;
end.