unit frmMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Spin, uButtons;
type
TForm1 =
class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
sedtBtnCount: TSpinEdit;
btnCreate: TButton;
gbButtons: TGroupBox;
ButtonPanel: TPanel;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnCreateClick(Sender: TObject);
private
{ Private-Deklarationen }
FMyButtonList : TMyButtonList;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FMyButtonList := TMyButtonList.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FMyButtonList.Free;
end;
procedure TForm1.btnCreateClick(Sender: TObject);
var
I, L : Integer;
MB : TMyButton;
begin
L := 2;
for I := FMyButtonList.Count
to sedtBtnCount.Value -1
do
begin
MB := TMyButton.Create(ButtonPanel);
MB.Width := 50;
MB.Height := 25;
MB.Left := L + (I * 50);
MB.Top := 2;
MB.Parent := ButtonPanel;
MB.
Index := FMyButtonList.Add(MB);
end;
end;
end.