UserGuide

Desktop Text Area

From Xojo Documentation

Text Area Library Icon

The Text Area control is a multi-line text field, such as a text editor or word processor. In contrast to a Text Field, it can contain multiple lines and styled text. A Text Area field with the Styled property set can display text in multiple fonts, styles, and sizes and have both horizontal and vertical scrollbars. Individual paragraphs can be left, centered, or right aligned via the StyledText class.

Text Area Styled

The Text Area supports the Edit menu’s Cut, Copy, and Paste menu items and keyboard shortcuts automatically. This functionality is built into the default Desktop Application project. If you rename or otherwise modify the Cut, Copy, and Paste menu items, you can disable the automatic functionality.

Text Fields also have built-in support for textual drag and drop.

Refer to TextArea in Language Reference for details on all its events, properties and methods.

Below is a list of common events, properties and methods.

Events

KeyDown

Called when a key is pressed while the Text Field has focus. The key that was typed is available as a parameter.

SelChange

Called when the selected text changes. Refer to UserGuide:Text Selection.

TextChange

Called when the text was changed, either by typing or through code (by setting the Text property).

Properties

SelPlain, SelTextColor, SelTextFont, SelTextSize, SelTextUnderline

Used to identify or set the type of style that is applied to the selected text.

SelLength, SelStart, SelText

Used to specify and set selected text in the Text Area. Refer to UserGuide:Text Selection.

Styled

Set this to True (ON) in the Inspector to allow the Text Area to contain styled text. Refer to UserGuide:Styled Text for more information.

StyledText

Enables you to access the properties and methods of the StyledText class for the text in the TextArea. Refer to UserGuide:Styled Text for more information.

Methods

ToggleSelectionBold, ToggleSelectionItalic, ToggleSelectionUnderline

Toggles the specified styled text attribute for the selected text.

Usage

To clear the text in a TextArea set it's Text property to the empty string:

TextField1.Text = ""

See Also

UserGuide:Text Selection, UserGuide:Styled Text, UserGuide:Desktop Text Field, UserGuide:Desktop Drag and Drop topics; TextArea class