2005. május 1., vasárnap

How to control the scroll buffer of a TMemo


Problem/Question/Abstract:

I would like the TMemo object to have a 250 line scroll buffer. In other words, when the 251 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?

Answer:

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

if memo1.Lines.Count = 251 then
  Memo1.lines.Delete(0);

Nincsenek megjegyzések:

Megjegyzés küldése