[lazarus] Detecting TMemo's lines property changing
Michael Van Canneyt
michael.vancanneyt at wisa.be
Tue Jul 13 03:18:56 EDT 1999
On Mon, 12 Jul 1999, Shane Miller wrote:
> I mentioned this problem before about detecting when TMemo's lines property
> changed and someone mentioned setting TStringList's OnChanged event. The
> problem with that is FLines is a TStrings and you can't access the OnChange
> property because it's in a child class.
>
> Is there something that I'm missing?
The Flines in TMemo are declared as FStrings, but they are assigned a TMemoStrings
in the Create method of TMemo. TMemostrings is a TStrings descendant that is
Memo-aware; i.e. when it changes, it notifies the memo about it.
You could do it with a TStringlist and it's onchange handler, but I think it is
better to make a TMemoStrings, which could be more adapted to the specifics of
a memo.
Of course then you must not forget to do a
Procedure TMemo.SetStrings(Avalue : TStrings);
begin
FLines.Assign(AVAlue);
end;
Because assigning a TStringlist to a TMemoStringlist directly wouldn't work :-)
Michael.
More information about the Lazarus
mailing list