A:
unit Foopan;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, Buttons, StdCtrls;
type
TFooPanel = class(TPanel)
private
{ Private declarations }
FButton: TButton;
FListbox: TListbox;
FListBoxFile: string;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
procedure SetFListBoxFile(s: string);
published
{ Published declarations }
property ListBoxFile: string read FListBoxFile write
SetFListBoxFile;
end;
procedure Register;
implementation
procedure TFooPanel.SetFListBoxFile(s: string);
begin
if s = '' then FListBox.items.clear
else FListBox.items.LoadFromFile(s);
FListBoxFile := s;
end;
constructor TFooPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Width := 131;
Height := 150;
caption := '';
FButton := TButton.Create(Self);
FButton.SetBounds(1, 1, 25, 25);
FButton.Parent := Self;
FListbox := TListbox.Create(Self);
FListbox.SetBounds(30, 1, 95, 145);
FListbox.Parent := Self;
end;
procedure Register;
begin
RegisterComponents('Samples', [TFooPanel]);
end;
end.