Notice Of Closure

Please note that this website is due to close down on 15th June 2020.

In the interim I will try to move as much content as possible over to my GitHub account. Thanks to everyone who has supported the site over the years.

» Help

How to control the scroll buffer of a TMemo

   
Question
I would like the TMemo object to have a 250 line scroll buffer. In other words, when the 251st line is added, the first line is removed from the TMemo object. Is there a way to accomplish this without having to copy each string from index n to index n - 1 each time the 250th line is added?

You can use TStrings' Delete method and pass the index to it.

if memo1.Lines.Count = 251 then
  Memo1.lines.Delete(0);
Original resource: The Delphi Pool
Author: Eddie Shipman
Added: 2009-09-14
Last updated: 2009-09-14

« Return to contents »