+5  A: 

You should do

procedure SetLines(Lines: TStrings);
begin
  FLinesText.Assign(Lines);
  // Repaint, update or whatever you need to do.
end;

You may also need to set the OnChange property of the FLines (do this in the constructor of your custom control, as soon as you have created it). Set it to any TNofifyEvent-compatible (private or protected, I guess) procedure of your component. In this procedure, you can do the repainting, updating etc. you need.

That is, do

constructor TControlPanelItem.Create(AOwner: TComponent);
begin
  inherited;
  FLinesText := TStringList.Create;
  TStringList(FLinesText).OnChange := LinesChanged;
end;

procedure TControlPanelItem.LinesChanged(Sender: TObject);
begin
  // Repaint, update or whatever you need to do.
end;
Andreas Rejbrand
I am already doing that. See procedure tControlPanelItem.SetLinesText that calls SetText. (procedure SetText is not complete. Im just using showmessage to see if it is working)
Delphiguy
OK, I didn't see that. (As you know, the code wasn't pretty a few minutes ago!) But I cannot see any `OnChange`?
Andreas Rejbrand
Hi. Thank you for your quick response. FLinesText is a stringlist and does not have an onchange property as far as I know?
Delphiguy
@Delphiguy: Yes, it has: http://docwiki.embarcadero.com/VCL/en/Classes.TStringList_Events. But since the variable is declared as a `TStrings` (which does **not** have this event), you need to tell the compiler/IDE that it is a `TStringList` explicitly. See my update.
Andreas Rejbrand
This is confusing. FLinesText is declared as TStrings that does not have a onchange property, however, FLinesText is created as a TStringList that does have the onchange event. Should I type cast?
Delphiguy
@Delphiguy: Yes, I saw that before you even posted your comment. See my update.
Andreas Rejbrand
@Andreas: Thank you so much! that worked perfectly! Been struggling with that the whole day!
Delphiguy