0

I'm using a TMemo in Lazarus to display a rolling log, but I want to limit it to the last 500 entries.

What I'd like to do is (in pseudo-code):

if (log_TMemo.Lines.Count > 500) then
   log_TMemo.Lines := log_TMemo[LinesCount - 500 to LinesCount];

TMemo contains TStrings TMemo.Lines, so I guess a want a way to copy a subset of the TStrings array.

Is there a way to do this, or is there another way?

Kromster
  • 7,181
  • 7
  • 63
  • 111
Fat Monk
  • 2,077
  • 1
  • 26
  • 59

1 Answers1

0

Although it uses iteration, this response in the Lazarus forums works perfectly.

while log_TMemo.Lines.Count > 500 do
    log_TMemo.Lines.Delete(0);
Fat Monk
  • 2,077
  • 1
  • 26
  • 59