Why doesn't my list property work?

I have made a simple component. However, the List property doesn't work. What is the problem? Sample below:

unit ListLabel;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TListLabel = class(TLabel)
  private
    FList: TStrings;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure SetList(Value: TStrings);
  published
    property List:TStrings read FList write SetList;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TListLabel]);
end;

procedure TListLabel.SetList(Value: TStrings);
begin
  FList.Assign(Value);
end;

constructor TListLabel.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FList:=TStrings.Create;
end;

destructor TListLabel.Destroy;
begin
  FList.Free;
  inherited Destroy;
end;

end.
LVL 2
CalvinDayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DrDelphiCommented:
The first thing you need to do is to replace the call the the Tstrings constructor. This is going to give you an abstract error. Use Tstringlist instead. Next, if you want to see the LIST property, you can assign the FList.Text to the Caption property...

procedure TListLabel.SetList(Value: TStrings);
begin
  FList.Assign(Value);
  Caption:=Flist.Text;
end;


good luck!!

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CalvinDayAuthor Commented:
Thanks.
0
DrDelphiCommented:
not a problem :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.