unit DemoFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TDemoForm =
class(TForm)
DemoButton: TButton;
ListBox: TListBox;
procedure DemoButtonClick(Sender: TObject);
procedure ButtonClick(Sender: TObject);
private
MyButton: TButton;
end;
var
DemoForm: TDemoForm;
implementation
{$R *.dfm}
procedure TDemoForm.DemoButtonClick(Sender: TObject);
begin
if Assigned(MyButton)
then
MyButton.Free;
MyButton := TButton.Create(self);
MyButton.Parent := self;
MyButton.Top := DemoButton.Top + 100;
MyButton.Left := DemoButton.Left;
MyButton.Caption := '
So geht es';
MyButton.OnClick := ButtonClick;
ListBox.OnDblClick := ButtonClick;
end;
procedure TDemoForm.ButtonClick(Sender: TObject);
begin
ShowMessage('
Hi');
end;
end.