FMX.Memo.TCustomMemo.Lines
Delphi
property Lines: TStrings read GetLines write SetLines;
C++
__property System::Classes::TStrings* Lines = {read=GetLines, write=SetLines};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | FMX.Memo.pas FMX.Memo.hpp |
FMX.Memo | TCustomMemo |
Description
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
- FMX.Memo.TCustomMemo.WordWrap
- FMX.Memo.TCustomMemo.Text
- FMX.Memo.TCustomMemo.GoToLineBegin
- FMX.Memo.TCustomMemo.GoToLineEnd
- System.Classes.TStrings