2.19 :gettext()

The :gettext() method returns text from the contents of an edittext.

Definition

string :gettext
(
  { integer Start input,
    integer End   := -1 input, }
  { enum    Type  := content_plain input }
)

Parameters

integer Start input
integer End := -1 input

These optional parameters define the range whose text shall be returned. If no range is specified, the text from .startsel to .endsel is returned, that is, the contents of the selection.

The value range of Start and End goes from 0 to the number of characters in the displayed text, with every character that can be included in a selection counting. Line break characters therefore count as well.

-1 can be specified for End to get the remaining text from the start position.

With the RTF edittext (.options[opt_rtf] = true), Start and End – similar to .startsel and .endsel – refer to positions in the formatted text. They cannot be used to infer positions in the content string of the RTF edittext, since this also contains formatting instructions. If the Start or End parameters are greater than the text length, then the text length is used for the RTF edittext.

enum Type := content_plain input

This optional parameter can be used with the RTF edittext to define whether the content of the text range will be returned as unformatted, plain text or as RTF including the formatting instructions.

Value range

content_plain

String contains plain, unformatted text.

content_rtf

String contains RTF text.

Only usable when .options[opt_rtf] = true.

Return value

String with the content of the specified text range.

Objects with this method

edittext