UserGuide

Desktop Text Area

From Xojo Documentation

Text Area Library Icon

The TextArea control is a multi-line text field, such as a text editor or word processor. In contrast to a TextField, it can contain multiple lines and styled text. A TextArea 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 TextArea 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.

TextFields 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 Value property).

Properties

SelectionPlain, SelectionTextColor, SelectionFontName, SelectionFontSize, SelectionUnderline - Used to identify or set the type of style that is applied to the selected text.

SelectionLength, SelectionStart, SelectedText - Used to specify and set selected text in the TextArea. Refer to UserGuide:Text Selection.

AllowStyledText - Set this to True (ON) in the Inspector to allow the TextArea 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

SelectionBold, SelectionItalic, SelectionUnderline - Toggles the specified styled text attribute for the selected text.

Usage

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

TextField1.Value = ""

See Also

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