FMX.Memo.TMemo.Lines

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Lines;

C++

__property Lines;

Properties

Type Visibility Source Unit Parent
property published
FMX.Memo.pas
FMX.Memo.hpp
FMX.Memo TMemo

Description

Provides access to the individual lines in the memo text.

FMX.Memo.TMemo.Lines inherits from FMX.Memo.TCustomMemo.Lines. All content below this line refers to FMX.Memo.TCustomMemo.Lines.

Provides access to the individual lines in the memo text.

The memo text can contain several line break symbols that separate the whole memo text into several lines. Depending on the current platform, a line break symbol can be a LF 'line feed' character (MacOS) or a CRLF 'carriage return' plus 'line feed' pair (Windows). Lines holds the memo text separated line by line.

When WordWrap is True then each line (specified in the Lines property) can be wrapped into several 'visual lines' to fit to the memo width. However these several 'visual lines' are still represented by a single string element in the Lines property.

Notice that GoToLineBegin and GoToLineEnd move the cursor to the beginning or the end of the current (pointed by the cursor) visual line.

Lines is a TStrings object, so you can use TStrings methods to work with the Lines property.

For example, you can count the number of lines:

ShowMessage('The number of lines:' + IntToStr(Memo1.Lines.Count));

You can add new lines:

Memo1.Lines.Append('New text to append at the end of memo');

You can delete lines:

Memo1.Lines.Delete(0); // Deletes the fist line from memo

You can replace a line with a new string:

Memo1.Lines[8] := 'Replace 9th  line with this string';

To work with all the memo's text at once, one can use the Text property.

See Also

Code Examples