On Thu, 27 Mar 2008 20:11:31 +0200 "Graeme Geldenhuys" <[EMAIL PROTECTED]> wrote:
> Hi, > > Andrew Haines started implementing a new TStrings descendant for use > as internal storage for fpGUI's Memo component (optimized for speed). > This got me curious as to why many developers don't use TStringList > itself. Look around and then also at LCL's TMemo, I noticed Mattias > seems to have had the same idea, implementing his own descendant class > called TTextStrings. Abstract from the unit (textstrings.pas) header: > > ---------------------- > TTextStrings is a TStrings descendant that is optimized for handling > the complete text as whole (instead of as line by line as in > TStringList). > ---------------------- > > It seems a lot of developers are not happy with TStringList. What's > the actual downside of using TStringList for internal storage in a > text component like Memo or ListBox? Performance? If so, why don't > we _fix_ the implementation in TStringList itself, instead of > everybody creating their own descendants? > > Yes, LCL's TMemo does currently use TStringList for internal storage, > but clearly Mattias did at some stage think of using TextStrings as > the commented code shows. I'm happy with TStringList. It should stay as an array of strings. But in some cases you want a text as single string and only occasionally access its lines. It's just a matter of optimization. You can not optimize for both. About TMemo: Nowadays every widgetset uses its own optimized TStrings descendant, so no need for TTextStrings. But a TTextStrings is needed in some cases. Mattias _______________________________________________ Lazarus mailing list [email protected] http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
