[Overview][Types][Classes][Index] Reference for unit 'TextStrings' (#lazutils)

TTextStrings

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a string list optimized to handle the complete text as a whole (instead of line by line as in TStringList).

Declaration

Source position: textstrings.pas line 52

type TTextStrings = class(TCustomMemoStrings)

protected

  FArraysValid: Boolean;

  

Boolean flag which indicates whether the array of line ranges is valid.

  FLineCount: Integer;

  

Number of lines in the array of line ranges.

  FLineCapacity: Integer;

  

Number of line ranges allocated for the component.

  FLineRanges: PTextLineRange;

  

Pointer to an array of TTextLineRange instances used for the Strings in the component.

  FText: string;

  

Member variable used to store the Text in the component.

  FUpdateCount: Integer;

  

Number of times BeginUpdate has been called without a corresponding EndUpdate.

  FChangedWhileUpdate: Boolean;

  

Indicates if Changed was called after calling BeginUpdate.

  function GetTextStr; override;

  

Gets the value for the Text property.

  procedure SetTextStr(); override;

  

Sets the value for the Text property.

  procedure BuildArrays; virtual;

  

Clears and builds the array with the line ranges for the values in Text.

  function GetCount; override;

  

Gets the value for the Count property.

  procedure Changed; virtual;

  

Performs actions needed after the value in Text is changed.

  procedure Changing; virtual;

  

Performs action needed when properties in the component are being updated.

  function Get(); override;

  

Gets the value for the indexed Strings property.

  procedure ClearArrays;

  

Clears the internal array of line ranges used in the component.

  function GetObject(); override;

  

Gets the value for the indexed Objects property.

  procedure Put(); override;

  

Sets the value for the indexed Strings property.

  procedure PutObject(); override;

  

Sets a value in the indexed Objects property.

  function GetLineLen();

  

Gets the length of a line (including optional end-of-line characters) at the specified position.

  function GetLineEnd();

  

Gets the ordinal position where the specified line ends in the Text property.

  function CountLineEndings();

  

Gets the number of end-of-line sequences found in the specified string.

public

  constructor Create;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destructor for the class instance.

  procedure Clear; override;

  

Clears the text and internal line ranges for the component.

  procedure SetText(); override;

  

Sets the value for the Text property from a PChar type.

  procedure Insert(); override;

  

Inserts the line of text in S at the specified position.

  procedure Delete(); override;

  

Deletes the line of text at the specified position.

  procedure Exchange(); override;

  

Swaps the line values at the specified positions.

  procedure Move(); override;

  

Moves a String value from the current position to the new position.

  procedure MakeTextBufferUnique;

  

Ensures that the reference count for the Text member is 1.

  procedure BeginUpdate;

  

Starts an update process for the component.

  procedure EndUpdate;

  

Finishes an update process for the component.

  function GetText; override;

  

Gets the value for the Text property as a PChar type.

  function IndexOf(); override;

  

Gets the ordinal position for the specified String value.

  function Add(); override;

  

Appends the specified text to the values in Strings.

  function AddObject(); override;

  

Adds a String and Object pair to the string list.

  procedure AddStrings(); override;

  

Adds the lines of text in TheStrings to the current class instance.

  procedure LoadFromFile(); override;

  

Loads the content in the string list from the specified file name.

  procedure SaveToFile(); override;

  

Saves the content in the string list to the specified file name.

  property Text: string; [rw]

  

Contains the textual representation for the values in Strings.

  property OnChange: TNotifyEvent; [rw]

  

Event handler signalled when values in Strings or Objects have been changed.

  property OnChanging: TNotifyEvent; [rw]

  

Event handler signalled before properties are updated in the component.

end;

Inheritance

TTextStrings

  

Implements a string list optimized to handle the complete text as a whole (instead of line by line as in TStringList).

|

TCustomMemoStrings

  

Implements a string list used in Memo controls.

|

TStrings

|

TPersistent,IFPObserved

|

TObject

Description

TTextStrings is a TCustomMemoStrings descendant which implements a string list optimized for handling the complete text in the list (rather than on a line by line basis).

The ancestor class ensures that lines of text with wordwrap line endings are handled in the component. TTextString uses an internal array of TTextLineRange instances to represent the lines of text. Overridden methods are provided to ensure that the internal line ranges are used to implement property values.

TTextStrings is the type instantiated for use in the Lines property in TCustomMemo.

See also

TCustomMemoStrings

  

Implements a string list used in Memo controls.

TCustomMemo.Create

TMemo


Version 3.2 Generated 2024-02-25 Home