unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
fcButton, fcImgBtn, fcShapeBtn, ExtCtrls, fcClearPanel, fcButtonGroup,
ADODB, Db, Grids, DBGrids, StdCtrls;
//既然是未知个:
//那么就用:Tlist;
type
PMyList = ^AList;
AList = record
btn:TfcButtonGroupItem
btnid:integer;//标示button
end;
type
TForm1 = class(TForm)
fcButtonGroup1: TfcButtonGroup;
fcButtonGroup1fcShapeBtn1: TfcShapeBtn;
fcButtonGroup1fcShapeBtn2: TfcShapeBtn;
fcShapeBtn1: TfcShapeBtn;
procedure fcShapeBtn1Click(Sender: TObject);
procedure a(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
MyList: TList;
ARecord: PMyList;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//button click message
procedure TForm1.a;
begin
application.MessageBox('ss','s',mb_ok);
end;
//add a button
procedure TForm1.fcShapeBtn1Click(Sender: TObject);
begin
New(ARecord);
arecord.btnid:=1;//你的标师
arecord^.btn:=fcButtonGroup1.ButtonItems.Add;
arecord^.Button.Caption:='lll';
arecord^.Button.OnClick:=a;//对应消息
end;
procedure TForm1.FormShow(Sender: TObject);
begin
MyList := TList.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
var
i:integer;
begin
for i:=0 to mylist.count-1 do
begin
ARecord:=mylist.items;
dispose(arecord);
end;
mylist.free;
end;
end.