Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add lines to the top of a memo in Delphi

The function Memo.Lines.Add('Some text') in Delphi adds the string to the bottom of the memo. Is there any function which adds the text to the top?

For example, if the Lines property of the Memo contains:

string 1
string 2
string 3

I want to add a string string 0 before string 1. How can I do that?

like image 569
Tim Wagner Avatar asked May 19 '15 19:05

Tim Wagner


1 Answers

The Lines property is a TStrings instance that supports inserting at a specified line number. The method to do so is Insert and is called like this:

Memo.Lines.Insert(0, 'string 0');
like image 70
David Heffernan Avatar answered Sep 26 '22 11:09

David Heffernan