Doing what Ulfeng proposes won't work. TListBox's Items property has this line in its Set method:
Items.Assign(Value);
so assigning SL to AListBox.Items only copies the string inside SL to the string holder of AList. The only way to do what you ask would be inheriting from TListBox and overriding the Items property with one of your own. Something like this:
TSLListBox = class(TListBox)
private
FSLItems: TStringList;
procedure SLChange(aSender: TObject);
procedure SetSLItems(const Value: TStringList);
published
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
property Items: TStringList read FSLItems write SetSLItems;
end;
implementation
{ TSLListBox }
constructor TSLListBox.Create(aOwner: TComponent);
begin
inherited;
FSLItems:= TStringList.Create;
FSLItems.OnChange:= SLChange;
end;
destructor TSLListBox.Destroy;
begin
FSLItems.Free;
inherited;
end;
procedure TSLListBox.SetSLItems(const Value: TStringList);
begin
FSLItems.Assign(Value);
end;
procedure TSLListBox.SLChange(aSender: TObject);
begin
// This line updates the original string repository with the changes made to SL
TListBox(Self).Items:= FSLItems;
end;
This approach has several disadvantages. First this is not a visual component nor a example of clean and nice inheritance. The second and more insidious problem is that properties are statically linked, meaning that if you pass a reference of your new ListBox to a procedure that expects a TListBox, the code inside the procedure will access the Items of TListBox and not those you declared. Any items added or deleted won't be reflected on FSLItems and your object will be inconsistent.
I'm not sure why you want to do this kind of modification, as almost everything available in a TStringList is also available in the TListBox. Maybe if you clarify a little more the pourpose of the mod, we can think of an alternative way of doing it.