[lazarus] Speaking of TMemo and RH9...

Tom Lisjac netdxr at adelphia.net
Thu Apr 17 15:30:19 EDT 2003



> > It works... but I can't help but wonder if there's a more elegant way to
> > make TMemo go? :)
> 
> The TTextString (or whatever is used) implementation of TMemo.Lines
> should respect the beginupdate/endupdate calls: Changes should not
> be applied till the updatecount reaches zero again.

Thanks for the reply!

The following provides exactly the same slow load (50+ seconds)...so I
wondered if beginupdate and endupdate had been implemented in TMemo:

        memo1.lines.beginupdate; // takes  to load
        try
          memo1.lines.loadfromfile(opendialog1.filename)
        finally
          memo1.lines.endupdate
        end;
        
This is also just as slow:

        x:=TStringlist.create;
        x.loadfromfile(opendialog1.filename);
        memo1.lines.beginupdate;
        try
          memo1.lines.text:=x.text;
        finally
          memo1.lines.endupdate;
          x.free
        end;
        
        
It seems that any operations using TMemo's Lines:TStrings property are
slow (with or without beginupdate and endupdate). Using Text:Widestring,
however, loads TMemo in less then a second:

        x:=TStringlist.create;
        try
          x.loadfromfile(opendialog1.filename);
          memo1.text:=x.text;
        finally
          x.free
        end
        
The workaround is perfectly acceptable... but the behavior of the lines
property seemed a little odd so I thought I'd mention it.

Best regards,

-Tom







More information about the Lazarus mailing list