Opens the text editor as a main window (not modally).


int textEditor(string propName, anytype propValue [, ...]);


Parameter Meaning
propName The name of the property. The different properties are described under "Description". See below.
propValue The value dependent on the used property.
... Further propName and propValue parameters. Enter the parameters pairwise. See the properties list below.

Return value





Opens the text editor. The parameters propName and propValue are always specified together and define how the text editor is shown e.g.

string s = "Hello World!"
textEditor("text", s);
  • You can define an arbitrary number of propName-propValue parameter pairs.

  • The amount of text that can be displayed is limited to 30MB.

The following properties can be used:

Name: "text"

Data type: string & (Note: the reference).

Description: Specifies the text that is shown. The text that is shown is saved in this variable. This is a string variable not a constant. Therefore, & is used. The changed text is also written into this variable.

Name: "file"

Data type: string

Description: The file name is saved in a string (whole path). The content is read from the file. When you save the file, the file is changed.

Name: "format"

Data type: string

Possible values: "plain", "rich", "config"

Description: Defines how a text can be edited. "plain" means plain text without format. "rich" is rich text that can contain HTML tags and the text can be edited (different formats can be set). You can, e.g., write own help pages or notes.

The "config" format opens a text editor in the style of the config editor with syntax highlighting. In case this is used, an additional menu entry "Settings..." is shown, which allows you to configure the font color and boldness for the different elements.

Name: "context"

Datatype: string

Default: <project-dir>

Description: Defines the start path for relative path specifications. The start path is a rich text and can be used to resolve the locations of files and images. If the text contains, for example, an image tag, <img src="image.png"> and the context is "path/to/look/in", the textEditor will try to load the image from "path/to/look/in/image.png"

Name: "wordWrap"

Data type: bool

Possible values: true, false

Default: false

Description: Defines whether the content of long rows is wrapped at the end (border) or if the text is shown on the same row and a horizontal scroll bar is shown.

Name: "readOnly"

Data type: bool

Possible values: true, false

Default: false

Description: Specifies whether the text can only be read (read only = true) or also edited (false).

Name: "font"

Datatype: string

Default: <System settings>;

Description: Specifies the font that is used for the "plain" text.

Name: "title"

Data type: string

Default: <File name> or ""

Description: Defines a text that is shown as window header.

Name: "encoding"

Data type: string

Default: <project locale encoding>

Description: Defines the endcoding of the displayed text. For a list of supported encodings, see: textEditor - encodings. If no encoding is specified, the current projects locale encoding is used.

Name: "detached"

Data type: string

Default: true

Description: Setting this options-pair allows you to open a text editor which does not block the CTRL thread until the text editor is closed.


  int i;
  string s = "Hello World!";
  i = textEditor("text",s);


This example shows how to enter the additional parameters.

  textEditor("text", "Hello", "readOnly", true, "detached", true);


Miscellaneous functions



See also