Witam!
Mam kod, który tworzy na formie głównej panel, z kilkoma kontrolkami; wśród nich znajduje się przycisk, który ma panel zamknąć (zniszczyc). I tu pojawia się problem; nie mam pomysłu jak to zrealizować
type
TDownloadItem = class (TSpTbxPanel) // panel
private
FButtonClose:TSpTBXButton;
procedure Close(Sender:TObject);
protected
public
constructor Create(AOwner:TCOmponent); override;
destructor Destroy; reintroduce;
end;
implementation
procedure TDownloadItem.Close(Sender: TObject);
begin
Self.Free;
end;
constructor TDownloadItem.Create(AOwner: TCOmponent);
begin
inherited Create(AOwner);
Parent:=TWinControl(AOwner);
Width:=500;
Height:=90 ;
Constraints.MaxHeight := 90;
ThemeType:=thtTBX;
TBXStyleBackground:=True;
Constraints.MinHeight := 90;
FButtonClose:= TSpTBXBUtton.Create(Self);
FButtonclose.Parent:=Self;
with FButtonclose do
begin
Parent:=Self;
Anchors := [akTop, akRight];
Width:=100;
Height:=23;
Left:=395;
Top:=33;
ThemeType:=thtTBX;
Caption:='Close';
Show;
OnClick:=Close;
end;
Align := alTop;
Show;
end;
destructor TDownloadItem.Destroy;
begin
FButtonClose.Free;
inherited Destroy;
end;
Juz mam wszystko napisane, pozostał mi tylko ten problem do rozwiązania.