TMemo max width

1.7k views Asked by At

Is there any way to make TMemo display text longer than 1024 into 1 line?
Take a look this simple code:

procedure TForm1.Button2Click(Sender: TObject);
var
    s: string;
    i: integer;
begin
    s := '';
    for i := 0 to 10000 do
      s := s + 'a';

    Memo1.Clear;
    Memo1.Lines.Add(s);
end;

The long text "s" will be displayed in multiple lines. The Memo1 will automatically wrap the text after 1024 characters.

1

There are 1 answers

0
Sertac Akyuz On

A TMemo is a wrapper for a native multi line edit control and is subject to the limitations it has. From INFO: Size Limits for a Multiline Edit Control:

A multiline edit control is also subject to the following limitations:

  • The maximum number of characters in a single line is 1024.
  • The maximum width of a line is 30,000 pixels.
  • The maximum number of lines is approximately 16,350.