<div class="meta" robots="noindex">

</div>

Class

# TextArea (deprecated)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2021r3. Please use `DesktopTextArea</api/user_interface/desktop/desktoptextarea>` as a replacement.

</div>

## Description

A <span class="title-ref">TextArea</span> control can contain multiple lines of text and can display mixed fonts, font sizes, and styles. For single-line text fields, use the `TextField</api/deprecated/textfield>` control.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                          | Type                                                   | Read-Only | Shared |
|---------------------------------------------------------------|--------------------------------------------------------|-----------|--------|
| `Active<textarea.active>`                                     | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `AllowAutoDeactivate<textarea.allowautodeactivate>`           | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowFocusRing<textarea.allowfocusring>`                     | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowSpellChecking<textarea.allowspellchecking>`             | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowStyledText<textarea.allowstyledtext>`                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowTabs<textarea.allowtabs>`                               | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowTabStop<textarea.allowtabstop>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `BackgroundColor<textarea.backgroundcolor>`                   | `Color</api/data_types/color>`                         |           |        |
| `Bold<textarea.bold>`                                         | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `Enabled<textarea.enabled>`                                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `FontName<textarea.fontname>`                                 | `String</api/data_types/string>`                       |           |        |
| `FontSize<textarea.fontsize>`                                 | `Single</api/data_types/single>`                       |           |        |
| `FontUnit<textarea.fontunit>`                                 | `FontUnits</api/graphics/fontunits>`                   |           |        |
| `Format<textarea.format>`                                     | `String</api/data_types/string>`                       |           |        |
| `Handle<textarea.handle>`                                     | `Integer</api/data_types/integer>`                     | ✓         |        |
| `HasBorder<textarea.hasborder>`                               | `Boolean</api/data_types/boolean>`                     |           |        |
| `HasHorizontalScrollbar<textarea.hashorizontalscrollbar>`     | `Boolean</api/data_types/boolean>`                     |           |        |
| `HasVerticalScrollbar<textarea.hasverticalscrollbar>`         | `Boolean</api/data_types/boolean>`                     |           |        |
| `Height<textarea.height>`                                     | `Integer</api/data_types/integer>`                     |           |        |
| `HideSelection<textarea.hideselection>`                       | `Boolean</api/data_types/boolean>`                     |           |        |
| `HorizontalScrollPosition<textarea.horizontalscrollposition>` | `Integer</api/data_types/integer>`                     |           |        |
| `Index<textarea.index>`                                       | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Italic<textarea.italic>`                                     | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `Left<textarea.left>`                                         | `Integer</api/data_types/integer>`                     |           |        |
| `LineHeight<textarea.lineheight>`                             | `Double</api/data_types/double>`                       |           |        |
| `LineSpacing<textarea.linespacing>`                           | `Double</api/data_types/double>`                       |           |        |
| `LiveUpdate<textarea.liveupdate>`                             | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockBottom<textarea.lockbottom>`                             | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockLeft<textarea.lockleft>`                                 | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockRight<textarea.lockright>`                               | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockTop<textarea.locktop>`                                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `MaximumCharactersAllowed<textarea.maximumcharactersallowed>` | `Integer</api/data_types/integer>`                     |           |        |
| `MouseCursor<textarea.mousecursor>`                           | `MouseCursor</api/user_interface/desktop/mousecursor>` |           |        |
| `MouseX<textarea.mousex>`                                     | `Integer</api/data_types/integer>`                     | ✓         |        |
| `MouseY<textarea.mousey>`                                     | `Integer</api/data_types/integer>`                     | ✓         |        |
| `MultiLine<textarea.multiline>`                               | `Boolean</api/data_types/boolean>`                     |           |        |
| `Name<textarea.name>`                                         | `String</api/data_types/string>`                       | ✓         |        |
| `PanelIndex<textarea.panelindex>`                             | `Integer</api/data_types/integer>`                     |           |        |
| `Parent<textarea.parent>`                                     | `Control</api/deprecated/control>`                     |           |        |
| `ReadOnly<textarea.readonly>`                                 | `Boolean</api/data_types/boolean>`                     |           |        |
| `Scope<textarea.scope>`                                       | `Integer</api/data_types/integer>`                     | ✓         |        |
| `SelectedText<textarea.selectedtext>`                         | `String</api/data_types/string>`                       |           |        |
| `SelectionAlignment<textarea.selectionalignment>`             | `Integer</api/data_types/integer>`                     |           |        |
| `SelectionBold<textarea.selectionbold>`                       | `Boolean</api/data_types/boolean>`                     |           |        |
| `SelectionFontName<textarea.selectionfontname>`               | `String</api/data_types/string>`                       |           |        |
| `SelectionFontSize<textarea.selectionfontsize>`               | `Single</api/data_types/single>`                       |           |        |
| `SelectionItalic<textarea.selectionitalic>`                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `SelectionLength<textarea.selectionlength>`                   | `Integer</api/data_types/integer>`                     |           |        |
| `SelectionPlain<textarea.selectionplain>`                     | `Boolean</api/data_types/boolean>`                     |           |        |
| `SelectionStart<textarea.selectionstart>`                     | `Integer</api/data_types/integer>`                     |           |        |
| `SelectionTextColor<textarea.selectiontextcolor>`             | `Color</api/data_types/color>`                         |           |        |
| `SelectionUnderline<textarea.selectionunderline>`             | `Boolean</api/data_types/boolean>`                     |           |        |
| `StyledText<textarea.styledtext>`                             | `StyledText</api/text/styledtext>`                     |           |        |
| `TabIndex<textarea.tabindex>`                                 | `Integer</api/data_types/integer>`                     |           |        |
| `Text<textarea.text>`                                         | `String</api/data_types/string>`                       |           |        |
| `TextAlignment<textarea.textalignment>`                       | `Integer</api/data_types/integer>`                     |           |        |
| `TextColor<textarea.textcolor>`                               | `Color</api/data_types/color>`                         |           |        |
| `Tooltip<textarea.tooltip>`                                   | `String</api/data_types/string>`                       |           |        |
| `Top<textarea.top>`                                           | `Integer</api/data_types/integer>`                     |           |        |
| `Transparent<textarea.transparent>`                           | `Boolean</api/data_types/boolean>`                     |           |        |
| `TrueWindow<textarea.truewindow>`                             | `Window</api/deprecated/window>`                       | ✓         |        |
| `Underline<textarea.underline>`                               | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `UnicodeMode<textarea.unicodemode>`                           | `UnicodeModes<textarea.unicodemodes>`                  |           |        |
| `ValidationMask<textarea.validationmask>`                     | `String</api/data_types/string>`                       |           |        |
| `VerticalScrollPosition<textarea.verticalscrollposition>`     | `Integer</api/data_types/integer>`                     |           |        |
| `Visible<textarea.visible>`                                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `Width<textarea.width>`                                       | `Integer</api/data_types/integer>`                     |           |        |
| `Window<textarea.window>`                                     | `Window</api/deprecated/window>`                       | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                          | Parameters                                                                                                                | Returns                                              | Shared |
|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|--------|
| `AcceptFileDrop<textarea.acceptfiledrop>`                     | FileType As `String</api/data_types/string>`                                                                              |                                                      |        |
| `AcceptPictureDrop<textarea.acceptpicturedrop>`               |                                                                                                                           |                                                      |        |
| `AcceptRawDataDrop<textarea.acceptrawdatadrop>`               | Type As `String</api/data_types/string>`                                                                                  |                                                      |        |
| `AcceptTextDrop<textarea.accepttextdrop>`                     |                                                                                                                           |                                                      |        |
| `AddText<textarea.addtext>`                                   | text As `String</api/data_types/string>`                                                                                  |                                                      |        |
| `CharacterPosition<textarea.characterposition>`               | LineNumber As `Integer</api/data_types/integer>`                                                                          | `Integer</api/data_types/integer>`                   |        |
| `Close<textarea.close_method>`                                |                                                                                                                           |                                                      |        |
| `Copy<textarea.copy>`                                         |                                                                                                                           |                                                      |        |
| `DrawInto<textarea.drawinto>`                                 | g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>` |                                                      |        |
| `InsertionPosition<textarea.insertionposition>`               | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                          | `Integer</api/data_types/integer>`                   |        |
| `Invalidate<textarea.invalidate>`                             | \[EraseBackground As `Boolean</api/data_types/boolean>`\]                                                                 |                                                      |        |
| `LineNumber<textarea.linenumber>`                             | CharPosition As `Integer</api/data_types/integer>`                                                                        | `Integer</api/data_types/integer>`                   |        |
| `Paste<textarea.paste>`                                       |                                                                                                                           |                                                      |        |
| `Refresh<textarea.refresh>`                                   | eraseBackground As `Boolean</api/data_types/boolean>`                                                                     |                                                      |        |
| `SelectAll<textarea.selectall>`                               |                                                                                                                           |                                                      |        |
| `SetFocus<textarea.setfocus>`                                 |                                                                                                                           |                                                      |        |
| `StyledTextPrinter<textarea.styledtextprinter>`               | g As `Graphics</api/graphics/graphics>`, Width As `Integer</api/data_types/integer>`                                      | `StyledTextPrinter</api/printing/styledtextprinter>` |        |
| `ToggleSelectionBold<textarea.toggleselectionbold>`           |                                                                                                                           |                                                      |        |
| `ToggleSelectionItalic<textarea.toggleselectionitalic>`       |                                                                                                                           |                                                      |        |
| `ToggleSelectionUnderline<textarea.toggleselectionunderline>` |                                                                                                                           |                                                      |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                        | Parameters                                                                                                                                                                              | Returns                            |
|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `Close<textarea.close_event>`                               |                                                                                                                                                                                         |                                    |
| `ConstructContextualMenu<textarea.constructcontextualmenu>` | Base As `MenuItem</api/deprecated/menuitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                          | `Boolean</api/data_types/boolean>` |
| `ContextualMenuAction<textarea.contextualmenuaction>`       | HitItem As `MenuItem</api/deprecated/menuitem>`                                                                                                                                         | `Boolean</api/data_types/boolean>` |
| `DragEnter<textarea.dragenter>`                             | obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`                                                                                   | `Boolean</api/data_types/boolean>` |
| `DragExit<textarea.dragexit>`                               | obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`                                                                                   |                                    |
| `DragOver<textarea.dragover>`                               | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>` | `Boolean</api/data_types/boolean>` |
| `DropObject<textarea.dropobject>`                           | Obj As `DragItem</api/user_interface/desktop/dragitem>` Action As `Integer</api/data_types/integer>`                                                                                    |                                    |
| `EnableMenuItems<textarea.enablemenuitems>`                 |                                                                                                                                                                                         |                                    |
| `GotFocus<textarea.gotfocus>`                               |                                                                                                                                                                                         |                                    |
| `KeyDown<textarea.keydown>`                                 | Key As `String</api/data_types/string>`                                                                                                                                                 | `Boolean</api/data_types/boolean>` |
| `KeyUp<textarea.keyup>`                                     | Key As `String</api/data_types/string>`                                                                                                                                                 |                                    |
| `LostFocus<textarea.lostfocus>`                             |                                                                                                                                                                                         |                                    |
| `MouseDown<textarea.mousedown>`                             | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                        | `Boolean</api/data_types/boolean>` |
| `MouseEnter<textarea.mouseenter>`                           |                                                                                                                                                                                         |                                    |
| `MouseExit<textarea.mouseexit>`                             |                                                                                                                                                                                         |                                    |
| `MouseMove<textarea.mousemove>`                             | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                                                                                        |                                    |
| `MouseUp<textarea.mouseup>`                                 | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                        |                                    |
| `MouseWheel<textarea.mousewheel>`                           | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`, DeltaX As `Integer</api/data_types/integer>`, DeltaY As `Integer</api/data_types/integer>`            | `Boolean</api/data_types/boolean>` |
| `Open<textarea.open>`                                       |                                                                                                                                                                                         |                                    |
| `SelChange<textarea.selchange>`                             |                                                                                                                                                                                         |                                    |
| `TextChange<textarea.textchange>`                           |                                                                                                                                                                                         |                                    |
| `ValidationError<textarea.validationerror>`                 | InvalidText As `String</api/data_types/string>`, StartPosition As `Integer</api/data_types/integer>`                                                                                    |                                    |

## Enumerations

<div id="textarea.unicodemodes">

<div class="rst-class">

forsearch

</div>

</div>

TextArea.UnicodeModes

### UnicodeModes

The method by which characters will be counted for the purposes of selection or range.

| Enum       | Description                                                                                                                           |
|------------|---------------------------------------------------------------------------------------------------------------------------------------|
| Native     | The native mode for the platform. Codepoints is the native mode for macOS and Windows. Characters is the native mode for Linux.       |
| Characters | Each logical character is counted as a single character regardless of how many bytes are actually required.                           |
| Codepoints | Each logical character is counted as the number of Unicode Codepoints (bytes) it requires. An emoji, for example, requires two bytes. |

## Property descriptions

<div id="textarea.active">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Active

**Active** As `Boolean</api/data_types/boolean>`

Indicates whether the `RectControl</api/deprecated/rectcontrol>` is active.

This property is read-only.

Active is `False</api/language/false>` when the `RectControl</api/deprecated/rectcontrol>`'s window is not in the foreground. When a `Window</api/deprecated/window>` is deactivated, its controls are automatically deactivated unless `RectControl.AllowAutoDeactivate<rectcontrol.allowautodeactivate>` is set to `False</api/language/false>`.

<div id="textarea.allowautodeactivate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AllowAutoDeactivate

**AllowAutoDeactivate** As `Boolean</api/data_types/boolean>`

Determines whether the control should be deactivated (on macOS) when the parent window is deactivated. The default is `True</api/language/true>`.

<div id="textarea.allowfocusring">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AllowFocusRing

**AllowFocusRing** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the control indicates that it has the focus with a ring around its border; if `False</api/language/false>`, the appearance of the control does not change when it has the focus.

This example is in the Initialized event of the control:

``` xojo
Me.AllowFocusRing = False
```

<div id="textarea.allowspellchecking">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AllowSpellChecking

**AllowSpellChecking** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, words that are believed to be misspelled are underlined.

This example is in the Initialized event of a \`TextArea\`:

``` xojo
Me.AllowSpellChecking = True  
```

<div id="textarea.allowstyledtext">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AllowStyledText

**AllowStyledText** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, styled text is allowed.

The MultiLine property must also be set to `True</api/language/true>` to permit styled text. If AllowStyledText is `False</api/language/false>`, then the <span class="title-ref">TextArea</span> cannot have a `StyledText</api/text/styledtext>` object.

<div id="textarea.allowtabs">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AllowTabs

**AllowTabs** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, pressing the Tab key will enter a tab into the control instead of moving the focus to the next item in the tab order.

<div id="textarea.allowtabstop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AllowTabStop

**AllowTabStop** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the **RectControl** is in the Tab Order and accepts the focus when the user tabs into it. The default is `True</api/language/true>`. If `False</api/language/false>`, the user cannot tab into it to give it the focus. However, the **RectControl** can gain the focus by other means, such as the user's clicking on it or by setting the focus in code.

This example removes the control from the Tab Order:

``` xojo
Me.AllowTabStop = False
```

<div id="textarea.backgroundcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.BackgroundColor

**BackgroundColor** As `Color</api/data_types/color>`

The background color for the control.

This code sets the value of the BackgroundColor property:

``` xojo
Me.BackgroundColor = &c110034
```

<div id="textarea.bold">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Bold

**Bold** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, applies the bold style to the control's caption and/or its text content if any.

This property is read-only.

Mac apps can only display font styles that are available. You cannot force a font to display in bold or italic if it does not have bold or italic variations available. In this situation, the Bold property will not affect the font.

<div id="textarea.enabled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Enabled

**Enabled** As `Boolean</api/data_types/boolean>`

Determines if the control should be enabled when the owning window is opened.

A disabled control cannot be clicked and cannot receive the focus.

This example disables the control. Its caption is grayed out.

``` xojo
Me.Enabled = False
```

<div id="textarea.fontname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.FontName

**FontName** As `String</api/data_types/string>`

Name of the font used to display the text content.

You can enter any font that is installed on the computer or the names of the two metafonts, "System" and "SmallSystem".

The System font is the font used by the system software as its default font. Different operating systems use different default fonts. If the system software supports both a large and small System font, you can also specify the "SmallSystem" font as your TextFont.

On macOS, "SmallSystem" specifies the OS's smaller system font and may make the control smaller in size as well. On Windows and Linux, "SmallSystem" is the same as "System".

This code sets the FontName property.

``` xojo
Me.FontName = "Helvetica"
```

<div id="textarea.fontsize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.FontSize

**FontSize** As `Single</api/data_types/single>`

Point size of the font used to display text content of a `Control</api/deprecated/control>`.

If you enter zero as the FontSize, your app will use the font size that works best for the platform on which it is running.

This code sets the font size to 16 points.

``` xojo
Me.FontSize = 16
```

<div id="textarea.fontunit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.FontUnit

**FontUnit** As `FontUnits</api/graphics/fontunits>`

The units in which FontSize is measured.

See the `FontUnits</api/graphics/fontunits>` enumeration for valid values.

This example is in the Initialized event of the control. It sets the font unit to Pixel.

``` xojo
Me.FontUnit = FontUnits.Pixel
```

<div id="textarea.format">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Format

**Format** As `String</api/data_types/string>`

Formats the contents of the control when it loses the focus.

It uses the same formatting conventions as the `Format</api/text/format>` function. To turn off formatting, set the Format property to the empty string, "".

If you need to enforce an entry format rather than permitting any entry, use the Format property in conjunction with the Mask property. See the description of the `ValidationMask<textedit.validationmask>` property and the section "Masks" in the Notes section.

This line applies a dollar format when the user tabs out of the field.

``` xojo
Me.Format = "\$###,###.##"
```

<div id="textarea.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Handle

**Handle** As `Integer</api/data_types/integer>`

Returns a handle to the control.

This property is read-only.

For interfacing with Mac APIs using `` Declare</api/language/declare>`s, RectControl.Handle returns NSViews (except for :doc:`Toolbar</api/deprecated/toolbar> ``).

On Windows returns the HWND of the control.

On Linux it returns a GtkWidget.

The following gets a handle to the control.

``` xojo
Var i As Integer = Me.Handle
```

<div id="textarea.hasborder">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.HasBorder

**HasBorder** As `Boolean</api/data_types/boolean>`

Indicates whether or not the border is visible.

<div id="textarea.hashorizontalscrollbar">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.HasHorizontalScrollbar

**HasHorizontalScrollbar** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the <span class="title-ref">TextArea</span> has a horizontal scrollbar and text does not wrap at the right edge of the <span class="title-ref">TextArea</span>.

<div id="textarea.hasverticalscrollbar">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.HasVerticalScrollbar

**HasVerticalScrollbar** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the <span class="title-ref">TextArea</span> includes a vertical scrollbar.

<div id="textarea.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Height

**Height** As `Integer</api/data_types/integer>`

The height (in points) of the control.

This example sets the height of the control to 100:

``` xojo
Me.Height = 100
```

<div id="textarea.hideselection">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.HideSelection

**HideSelection** As `Boolean</api/data_types/boolean>`

HideSelection hides the selection highlight when the <span class="title-ref">TextArea</span> loses the focus. The default is `True</api/language/true>`.

If HideSelection is `False</api/language/false>`, then the <span class="title-ref">TextArea</span> retains its selection when another field gains the focus. HideSelection is currently a Windows only property.

<div id="textarea.horizontalscrollposition">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.HorizontalScrollPosition

**HorizontalScrollPosition** As `Integer</api/data_types/integer>`

Scrolls the text control horizontally to the position (in points) from the left edge of the control.

This code scrolls the control horizontally by 200 points.

``` xojo
TextArea1.HorizontalScrollPosition = 200
```

<div id="textarea.index">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Index

**Index** As `Integer</api/data_types/integer>`

If the control is used in a control set, this specifies the control's index in the set.

This property is read-only.

The *control set* is often used to manage a group of RadioButtons since a single RadioButton in a window doesn't make much sense. Most typically, you create an instance of the RadioButton, assign 0 to its Index property, and then duplicate it. This increments the value of Index for each new instance but retain the original control's name.

To determine which RadioButton the user clicked, use the Action event handler of the control set. The parameter *Index* contains the value of Index for the RadioButton that was clicked. The event handler is this:

``` xojo
Sub Action(Index As Integer)
  Label1.Text = "You chose radio button " + index.ToString + "."
End Sub
```

To set a RadioButton in a control set, you use its *Index* property to refer to the RadioButton whose value you want to set. For example, the following line selects the second RadioButton from code:

``` xojo
RadioButton1(1).Value = True ' 0-based
```

<div id="textarea.italic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Italic

**Italic** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, applies the italic style to the control's caption and/or its text content if any.

This property is read-only.

Mac apps can only display font styles that are available. You cannot force a font to display in bold or italic if it does not have bold or italic variations available. In this situation, the Italic property will not affect the font.

<div id="textarea.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Left

**Left** As `Integer</api/data_types/integer>`

The left side of the control in local coordinates (relative to the window).

The following example moves the control 100 points from the left side of the window:

``` xojo
Me.Left = 150
```

<div id="textarea.lineheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LineHeight

**LineHeight** As `Double</api/data_types/double>`

Controls the height of each line in the <span class="title-ref">TextArea</span> control (it is global so the effect spans all paragraphs). A value of 0 maintains the default line height of the control, while any other value changes the height of each line. The value is tied to the TextUnit property, so if the TextUnit is in Inches then the LineHeight value specifies a height in Inches.

<div class="note">

<div class="title">

Note

</div>

Due to lack of support in GTK, LineHeight does not have any effect on Linux.

</div>

Be aware that LineHeight is the exact and literal height that the line will be treated as -- text can overlap if the value is too low.

<div id="textarea.linespacing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LineSpacing

**LineSpacing** As `Double</api/data_types/double>`

This controls the spacing between lines. So if you wanted your lines to be double spaced, you would enter a value of 2. The default value is 1, or single spaced.

On Linux, LineSpacing is not accurate if the <span class="title-ref">TextArea</span> has variable text sizes.

<div id="textarea.liveupdate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LiveUpdate

**LiveUpdate** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, then the control will dynamically update the bound data value. Relevant when the control is bound to another control.

``` xojo
Me.LiveUpdate = True
```

<div id="textarea.lockbottom">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LockBottom

**LockBottom** As `Boolean</api/data_types/boolean>`

Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning window.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockBottom = True
```

<div id="textarea.lockleft">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LockLeft

**LockLeft** As `Boolean</api/data_types/boolean>`

Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning window.

Beginning with version 2009r5, LockLeft and Locktop default to `True</api/language/true>` when you add a new control to a window. Existing controls will be altered only if LockRight and/or LockBottom are not set. *LockLeft* has no effect unless *LockRight* is `True</api/language/true>`.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockLeft = True
```

<div id="textarea.lockright">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LockRight

**LockRight** As `Boolean</api/data_types/boolean>`

Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning window.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockRight = True
```

<div id="textarea.locktop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LockTop

**LockTop** As `Boolean</api/data_types/boolean>`

Determines whether the top edge of the control should stay at a set distance from the top edge of the parent control, if there is one, or the owning window.

Beginning with version 2009r5, LockTop and LockLeft default to `True</api/language/true>` when you add a control to a window. Existing controls will be altered only if LockRight and/or LockBottom are not set. *LockTop* has no effect unless *LockBottom* is `True</api/language/true>`.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockTop = True
```

<div id="textarea.maximumcharactersallowed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MaximumCharactersAllowed

**MaximumCharactersAllowed** As `Integer</api/data_types/integer>`

The maximum number of characters allowed in the <span class="title-ref">TextArea</span>.

The value of zero does not limit text. MaximumCharactersAllowed works for normal text entry, copy and paste, and drag and drop.

There may be maximum limits imposed by the operating system.

<div id="textarea.mousecursor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseCursor

**MouseCursor** As `MouseCursor</api/user_interface/desktop/mousecursor>`

The cursor to be displayed while the mouse is within the control and both the `DesktopApplication</api/user_interface/desktop/desktopapplication>` and `Window</api/deprecated/window>` class's MouseCursor properties are `Nil</api/language/nil>`.

If the `DesktopApplication</api/user_interface/desktop/desktopapplication>` class's MouseCursor property is not `Nil</api/language/nil>` or the `Window</api/deprecated/window>`'s MouseCursor property is not `Nil</api/language/nil>`, then any control's MouseCursor property is ignored. You can use a cursor stored in the `Cursors</api/user_interface/desktop/cursors>` module. On Macintosh, you can also obtain a `MouseCursor</api/user_interface/desktop/mousecursor>` from a resource file.

This line in the Open event of the control sets the default cursor to the finger pointer.

``` xojo
Me.MouseCursor = System.Cursors.FingerPointer
```

<div id="textarea.mousex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseX

**MouseX** As `Integer</api/data_types/integer>`

The X coordinate of the mouse (points). Measured from the top-left corner of the control.

This property is read-only.

This code is in the MouseDown event of a `TextField</api/deprecated/textfield>` and displays the X-coordinate at the point of the MouseDown event.

``` xojo
Me.Value = Str(Me.MouseX)
```

<div id="textarea.mousey">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseY

**MouseY** As `Integer</api/data_types/integer>`

The Y coordinate of the mouse (points). Measured from the top-left corner of the control.

This property is read-only.

This code is in the MouseDown event of a `TextField</api/deprecated/textfield>` and displays the Y-coordinate at the point of the MouseDown event.

``` xojo
Me.Value = Str(Me.MouseY)
```

<div id="textarea.multiline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MultiLine

**MultiLine** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, wrap text to multiple lines and allow more than 32K of text.

Changing this property at runtime has no effect.

Page Up, Page Down, Home and End keys are supported for multiline TextAreas. A vertical scroll bar is added automatically when MultiLine is `True</api/language/true>`.

MultiLine TextAreas support any standard terminator (Return, Linefeed, or Return + Linefeed) to indicate the end of a paragraph.

<div id="textarea.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Name

**Name** As `String</api/data_types/string>`

The name of the control. Set the name of the control in the Inspector.

This property is read-only.

<div id="textarea.panelindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.PanelIndex

**PanelIndex** As `Integer</api/data_types/integer>`

If the control has been placed on a `TabPanel</api/deprecated/tabpanel>` or `PagePanel</api/deprecated/pagepanel>` control, this is the panel (page/tab) that the control is on. If the control is not on a panel, it returns -1.

The first panel is numbered zero. If the control has been placed on a panel of a `TabPanel</api/deprecated/tabpanel>` or `PagePanel</api/deprecated/pagepanel>` control, it returns the panel number. If the control is not on a `PagePanel</api/deprecated/pagepanel>` or `TabPanel</api/deprecated/tabpanel>`, it returns -1. If you change the PanelIndex to a nonexistent panel, the control will disappear until you give it a PanelIndex value that corresponds to a panel that exists.

If you are looking to change the currently selected panel (page/tab), use `PagePanel.SelectedPanelIndex<pagepanel.selectedpanelindex>`.

This code displays the panel index of the control that is on the page.

``` xojo
Label3.Value = Str(Me.PanelIndex)
```

<div id="textarea.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Parent

**Parent** As `Control</api/deprecated/control>`

Used to get and set the control's parent control or window.

Returns `Nil</api/language/nil>` if the parent is the window. Assign `Nil</api/language/nil>` to make the control's parent the window, even if it is enclosed by another control. The child control's behavior in the IDE will reflect the parent's state. If the parent control is somehow in another window, an `InvalidParentException</api/exceptions/invalidparentexception>` will occur.

The following example sets the parent of the control to the window.

``` xojo
Me.Parent = Nil
```

<div id="textarea.readonly">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ReadOnly

**ReadOnly** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the text of the control cannot be modified.

This example is in the Open event of the control.

``` xojo
Me.ReadOnly = True
```

<div id="textarea.scope">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Scope

**Scope** As `Integer</api/data_types/integer>`

Used to determine whether access to the control is Public (0) or Private (2). The default is Public.

This property is read-only.

If the Scope of a control is set to Private, it cannot be accessed from outside its parent window.

<div id="textarea.selectedtext">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectedText

**SelectedText** As `String</api/data_types/string>`

The currently selected text.

This example places the selected text from a <span class="title-ref">TextArea</span> into a `TextField</api/deprecated/textfield>`.

``` xojo
TextArea1.SelectionStart = 0
TextArea1.SelectonLength = 10

TextField1.Text = TextArea1.SelectedText
```

<div id="textarea.selectionalignment">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionAlignment

**SelectionAlignment** As `Integer</api/data_types/integer>`

Controls paragraph alignment of the selected text.

Use `TextAlignments</api/text/textalignments>` with this property.

This example sets the alignment of the selected paragraph in TextArea1 to centered:

``` xojo
TextArea1.SelectionAlignment = TextAlignments.Center
```

This example displays a dialog box if the selected paragraph is centered.

``` xojo
If TextArea1.SelectionAlignment = TextAlignments.Center then
  MessageBox("The text is centered.")
End If
```

<div id="textarea.selectionbold">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionBold

**SelectionBold** As `Boolean</api/data_types/boolean>`

Used to get and set the bold style of the selected text.

<div id="textarea.selectionfontname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionFontName

**SelectionFontName** As `String</api/data_types/string>`

Used to get and set the text font of the selected text.

When used in an unstyled <span class="title-ref">TextArea</span>, it changes the font of all the text in the <span class="title-ref">TextArea</span>.

<div id="textarea.selectionfontsize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionFontSize

**SelectionFontSize** As `Single</api/data_types/single>`

Used to get and set the font size of the selected text.

When used in an unstyled <span class="title-ref">TextArea</span> it changes the font size of all the text in the <span class="title-ref">TextArea</span>.

<div id="textarea.selectionitalic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionItalic

**SelectionItalic** As `Boolean</api/data_types/boolean>`

Used to get and set the italic style of the selected text.

<div id="textarea.selectionlength">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionLength

**SelectionLength** As `Integer</api/data_types/integer>`

The number of selected characters.

A SelectionLength of 0 means an insertion point rather than a selection. A value greater than the number of characters in the control means that the selection is from `SelectionStart<textedit.selectionstart>` to the end of the control.

On Windows, selecting text via code does not display the text as selected unless the control has the focus. If you want this behavior, call `SetFocus<rectcontrol.setfocus>` before setting the selection.

This example selects the first 10 characters of TextArea1.

``` xojo
TextArea1.SelectionStart = 0
TextArea1.SelectionLength = 10
```

<div id="textarea.selectionplain">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionPlain

**SelectionPlain** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the selected text is plain. If the selected text is styled (e.g., Bold), setting SelectionPlain to True changes it to Plain.

<div id="textarea.selectionstart">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionStart

**SelectionStart** As `Integer</api/data_types/integer>`

The position of the insertion point.

A value of zero means that the insertion point is before the first character. Use SelectionStart to set the position of the insertion point in the text. Use SelectionStart in conjunction with `SelectionLength<textedit.selectionlength>` to select a portion of the text in the control, beginning with SelectionStart and extending for `SelectionLength<textedit.selectionlength>` characters.

On Windows, selecting text via code does not display the text as selected unless the control has the focus. If you want this behavior, call `SetFocus<rectcontrol.setfocus>` before setting the selection.

This example selects the first 10 characters of TextArea1.

``` xojo
TextArea1.SelectionStart = 0
TextArea1.SelectionLength = 10
```

<div id="textarea.selectiontextcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionTextColor

**SelectionTextColor** As `Color</api/data_types/color>`

Used to get and set the text color of the selected text.

When used in an unstyled <span class="title-ref">TextArea</span>, it changes the color of all the text in the <span class="title-ref">TextArea</span>.

<div id="textarea.selectionunderline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectionUnderline

**SelectionUnderline** As `Boolean</api/data_types/boolean>`

Used to get and set the underline style of the selected text.

<div id="textarea.styledtext">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.StyledText

**StyledText** As `StyledText</api/text/styledtext>`

Enables you to access the properties and methods of the `StyledText</api/text/styledtext>` class for the text in the <span class="title-ref">TextArea</span>.

If the Styled property is Off then this property returns Nil.

The <span class="title-ref">TextArea</span> must have its MultiLine and Styled properties set to `True</api/language/true>`. The object returned by StyledText is not a copy, so subsequent changes to it will affect the contents of the <span class="title-ref">TextArea</span>. See the example in the section "Using the StyledText Class" in the Notes for the <span class="title-ref">TextArea</span> class.

<div id="textarea.tabindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.TabIndex

**TabIndex** As `Integer</api/data_types/integer>`

The **RectControl's** position in the Tab Order. It is 0-based. A TabIndex of 0 is the first **RectControl** to get the focus.

On the Mac you need Full Keyboard Access turned on in System Preferences (Keyboard-\>Shortcuts) in order to manually set focus to non-text controls.

This example sets the control's TabIndex.

``` xojo
Me.TabIndex = 2
```

<div id="textarea.text">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Text

**Text** As `String</api/data_types/string>`

The text displayed.

Assigning a `string</api/data_types/string>` to the Text property replaces the entire contents of the control. The font, size, and color are uniform and match the values last set with the FontName, FontSize, and TextColor properties, or if these haven't been used, the settings in the IDE.

Please note that the implementation of the `TextField</api/deprecated/textfield>` and <span class="title-ref">TextArea</span> controls is platform dependent. Do not expect that the text you assign is the same as the text you receive from this property. For example on Mac your text is converted to UTF-8 internally. On Windows all text after a null character (which means chr(0) and not "0") is ignored. End of line characters can change to their platform specific counterpart. Special characters with `Asc</api/math/asc>` values below 32 may be ignored or removed.

Clear (remove) any text that is displayed in the \`TextArea\`:

``` xojo
TextArea1.Text = ""
```

This example places the selected text from a <span class="title-ref">TextArea</span> into a `TextField</api/deprecated/textfield>`.

``` xojo
TextArea1.SelStart = 0
TextArea1.SelLength = 10

TextField1.Text = TextArea1.SelText
```

<div id="textarea.textalignment">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.TextAlignment

**TextAlignment** As `Integer</api/data_types/integer>`

Sets the paragraph alignment for entire contents of the control.

Use the `TextAlignments</api/text/textalignments>` enumeration to get/set the value of this property.

For the <span class="title-ref">TextArea</span> control, use the `SelectionAlignment<textarea.selectionalignment>` property to set paragraph alignments for individual paragraphs. Currently the Default alignment is the same as Left aligned. Setting the alignment on Linux requires GTK+ 2.4 or greater.

This example is in the Initialized event of the control.

``` xojo
Me.TextAlignment = TextAlignments.Center
```

<div id="textarea.textcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.TextColor

**TextColor** As `Color</api/data_types/color>`

Gets or sets the color of the caption or the text content. The default value is black.

<div id="textarea.tooltip">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Tooltip

**Tooltip** As `String</api/data_types/string>`

Text of help message displayed as a Windows or Linux "tooltip" or macOS help tag.

The tip/tag is displayed when the user hovers the mouse cursor over the control.

This example adds a tooltip to a `BevelButton</api/deprecated/bevelbutton>` that has an icon.

``` xojo
Me.CaptionAlignment = 0 ' left
Me.CaptionDelta = 10
Me.Tooltip = "Click to bark."

Me.Icon = Woof ' added to the project
Me.CaptionPosition = 2
```

<div id="textarea.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Top

**Top** As `Integer</api/data_types/integer>`

The top of the control in local coordinates (relative to the window).

This example sets the top of the control to 140 points from the top of the window:

``` xojo
Me.Top = 140
```

<div id="textarea.transparent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Transparent

**Transparent** As `Boolean</api/data_types/boolean>`

Determines whether the control is transparent on Windows. The default is `False</api/language/false>`. Has no effect on macOS or Linux.

Transparent controls draw more slowly and use more memory in order to cache the background. Unless you absolutely require transparency, leave this set to False.

For projects that were created prior to 2018r1, this property defaults to True to emulate previous behavior. Consider changing it to False to improve performance if you do not require transparency.

<div id="textarea.truewindow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.TrueWindow

**TrueWindow** As `Window</api/deprecated/window>`

Returns a reference to the actual enclosing `Window</api/deprecated/window>`.

This property is read-only.

TrueWindow walks up the window hierarchy and finds the actual enclosing window regardless of how deeply nested the `RectControl</api/deprecated/rectcontrol>` or `DesktopContainer</api/user_interface/desktop/desktopcontainer>` hierarchy is.

`Window</api/deprecated/window>` also has a TrueWindow property.

This example accesses the TrueWindow and displays its Title property in a `TextField</api/deprecated/textfield>`.

``` xojo
TextField1.Text = Me.TrueWindow.Title
```

<div id="textarea.underline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Underline

**Underline** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, applies the underline style to the control's caption and/or its text content if any.

This property is read-only.

<div id="textarea.unicodemode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.UnicodeMode

**UnicodeMode** As `UnicodeModes<textarea.unicodemodes>`

The method by which the method `SelectionLength<textedit.selectionlength>` will count the selection.

Choosing Characters will result in a count of the number of logical characters in the selection. For example, a emoji would be counted as a single character. Choosing CodePoints will result in a count of the number of Unicode CodePoints (basically bytes) that the characters in the selection consume. An emoji, for example, requires two bytes.

The default setting is Characters on all platforms. However, for backwards compatibility, <span class="title-ref">TextArea</span> controls on layouts created in projects prior to 2020r1 will be set to Native which means CodePoints on macOS and Windows and Characters on Linux.

<div id="textarea.validationmask">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ValidationMask

**ValidationMask** As `String</api/data_types/string>`

Use the ValidationMask property to filter user input on a character-by-character basis and add formatting characters.

For example, a mask for a Telephone number field can add parentheses, spaces, and dashes as literals, that are used for formatting, and the digit mask symbol '#' to restrict entry to numbers only. It uses the same mask characters as Visual Basic. If the user enters a character that is prohibited by the mask, it causes the ValidationFailed event to occur.

You can use the ValidationMask property in conjunction with the Format property. The ValidationMask filters the entry, while the Format property applies a format to the entry. The formats are the same as for the `Format</api/text/format>` function.

The `TextField</api/deprecated/textfield>` will autocomplete any literal mask characters for the user. If the user uses the Backspace key he/she can backup the autocompletion but only 1 character at a time.

To turn off the ValidationMask, set it to the empty string, "".

You can set the ValidationMask property in the Properties pane. If you use the "#" character as the first character of the mask, there is the remote possibility that it may be confused with the name of a constant. When you use a constant in the Properties pane, you precede its name with the "#" sign. If you want both a constant and a mask to be named "Example", then you should create a new constant named "poundExample" with its value set to "#Example" and assign that in the Properties pane.

The following table shows the characters that you can use to define a mask.

| Mask Character | Description                                                                                                                                                                                                                                                                                    |
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| \#             | The single digit placeholder. The user can type only a digit (numeric) character in this position. For example, the mask "(###) \###-####" accepts the entry 5551212121" and returns "(555) 121-2121".                                                                                         |
| .              | Decimal placeholder.                                                                                                                                                                                                                                                                           |
| ,              | Thousands separator.                                                                                                                                                                                                                                                                           |
| :              | Time separator.                                                                                                                                                                                                                                                                                |
| /              | Date separator.                                                                                                                                                                                                                                                                                |
|                | Mask escape character.                                                                                                                                                                                                                                                                         |
| &              | Character or space placeholder. It accepts one character.                                                                                                                                                                                                                                      |
| C              | Character or space placeholder, where entry is optional. It operates like the '&' placeholder. For example, the mask "CCCC-CC" formats "1233ed" as "1233-ed".                                                                                                                                  |
| \>             | Convert all the characters that follow to uppercase.                                                                                                                                                                                                                                           |
| \<             | Convert all the characters that follow to lowercase.                                                                                                                                                                                                                                           |
| A              | Alphanumeric character placeholder, where entry is mandatory.                                                                                                                                                                                                                                  |
| a              | Alphanumeric character placeholder, where entry is optional.                                                                                                                                                                                                                                   |
| 0              | The literal "0" (zero). For example, the mask "99.00" formats the entry "22" as "22.00". The mask "CC0-9999" accepts the entry "1234" and returns it as "CC0-1234". The mask "##,###.00" accepts the entry "12345" and returns "12,345.00". The mask "99.00" accepts "21" and returns "21.00". |
| 9              | A Single (numeric) digit, where entry is optional.                                                                                                                                                                                                                                             |
| ?              | Alphabetic placeholder. Entry is optional. For example, the mask "???" accepts three alphabetic characters. It rejects numeric characters.                                                                                                                                                     |
| Any literal    | All other symbols are displayed as literals for formatting purposes. For example, the mask "99\[9\]" accepts the entry "333" and returns "33\[3\]".                                                                                                                                            |
| ~              | Reserved for future use. If you use "~" it will trigger an exception error. Use ~ instead.                                                                                                                                                                                                     |

| Mask         | Description                                                          |
|--------------|----------------------------------------------------------------------|
| 999,999.99   | Formats 11122233 as "111,222.33" (Using the US thousands separator.) |
| 99.00        | Formats "22" as "22.00."                                             |
| \###-##-#### | US Social Security number. Fomats "123456789" as 123-45-6789.        |

:

``` xojo
TextField1.ValidationMask = "###-##-####"
TextField1.ValidationMask = "(###) ###-####" ' US Phone number, with area code
```

If the user tries to enter a character that is prohibited by the mask, a ValidationFailed event occurs. The character that the user attempted to enter and the character position is passed to the ValidationFailed event, where you can handle the keystroke as you like.

To cancel the ValidationMask, set it to the empty string:

``` xojo
TextField1.ValidationMask = ""
```

<div id="textarea.verticalscrollposition">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.VerticalScrollPosition

**VerticalScrollPosition** As `Integer</api/data_types/integer>`

Use to get or set the topmost visible line (zero-based).

Use this property to determine the first visible line; set this property to scroll the control. Setting it to the last line or beyond the last line will move the vertical scrollbar's thumb to the bottom, not necessarily displaying the last line at the top of the control.

<div id="textarea.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Visible

**Visible** As `Boolean</api/data_types/boolean>`

Determines whether the control is visible when its owning window is opened. The default is `True</api/language/true>`: the control is visible.

The following code in the DisclosureTriangle Action event handler displays or hides a ListBox on the window:

``` xojo
ListBox1.Value = Me.Visible
```

<div id="textarea.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Width

**Width** As `Integer</api/data_types/integer>`

The width (in points) of the control.

The following example resizes the control:

``` xojo
Me.Width = 200
```

<div id="textarea.window">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Window

**Window** As `Window</api/deprecated/window>`

The control's parent window.

This property is read-only.

This code gets the parent window's Title property.

``` xojo
TextField1.Text = Me.Window.Title
```

## Method descriptions

<div id="textarea.acceptfiledrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AcceptFileDrop

**AcceptFileDrop**(FileType As `String</api/data_types/string>`)

Permits documents of type *FileType* to be dropped on the control. *FileType* must be a file type that you defined in via the `FileType</api/files/filetype>` class or the File Type Sets Editor.

This code in the Open event of an `ImageWell</api/deprecated/imagewell>` makes it possible for the user to drop either a picture or a file that is a jpeg image. The File Type Sets editor was used to define the “image/jpeg” file type. It is one of the “Common File Types” that is available in the editor.

``` xojo
Me.AcceptPictureDrop
Me.AcceptFileDrop("image/jpeg")
```

To restrict file drops to just folders (and not files), you can put this code in the `DragEnter<rectcontrol.dragenter>` event:

``` xojo
If Not obj.FolderItem.IsFolder Then Return True
```

<div id="textarea.acceptpicturedrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AcceptPictureDrop

**AcceptPictureDrop**

Permits pictures to be dropped on the control.

If a control should accept pictures in a drag and drop, then AcceptPictureDrop needs to be called prior to the drop. Typically, it is in the Open event of the control itself. For example, the line:

``` xojo
Me.AcceptPictureDrop
```

in the Open event of the control that will receive the dragged pictures is needed. When the picture is dropped, the `DropObject<rectcontrol.dropobject>` event is called and this is where you will put your code to handle the drop.

Canvas.Open:

``` xojo
Me.AcceptPictureDrop
```

Canvas.DropObject:

``` xojo
If obj.PictureAvailable Then
  Me.Backdrop = obj.Picture
End If
```

<div id="textarea.acceptrawdatadrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AcceptRawDataDrop

**AcceptRawDataDrop**(Type As `String</api/data_types/string>`)

Permits data (of the Type specified) to be dropped on the control.

The following specfies a generic file type defined in the File Type Sets editor.

``` xojo
Me.AcceptRawDataDrop("????")
```

<div id="textarea.accepttextdrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AcceptTextDrop

**AcceptTextDrop**

Permits text to be dropped on the control.

This line in the Open event of a control that can accept dragged text.

``` xojo
Me.AcceptTextDrop
```

<div id="textarea.addtext">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.AddText

**AddText**(text As `String</api/data_types/string>`)

Adds the passed *text* to the current Text. Call AddText rather than using the `+</api/language/operators/mathematical/+>` operator to add text to existing text.

This example reads a text field in blocks of 1000 characters using Read.

``` xojo
Var f As FolderItem
Var dlg As OpenDialog
Var t As TextInputStream

' create a new openDialog
dlg = New OpenFileDialog
' set what type of file it looks for
dlg.Filter = "text/plain"

' run the dialog
f = dlg.ShowModal

' check to make sure the user didn't click cancel
If f <> Nil Then
  Try
    t = TextInputStream.Open(f)
    ' Read all of the text, 1000 characters at a time
    ' into the TextField
    While Not t.EndOfFile
      myTextArea.AddText(t.Read(1000, Encodings.UTF8))
    Wend
    t.Close
  Catch error As IOException
    ' the file could not be a read as a text file
    MessageBox("The selected file is not a text file. Error: " + error.Message)
  End If
Else
  ' the user clicked cancel... just ignore it
End If
```

<div id="textarea.characterposition">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.CharacterPosition

**CharacterPosition**(LineNumber As `Integer</api/data_types/integer>`) As `Integer</api/data_types/integer>`

Returns as an `Integer</api/data_types/integer>` the character position for pixel coordinates *X*, *Y* relative to the control.

Characters are numbered consecutively from the start until the end of the control. The first character is numbered 1. The first line is numbered zero.

This example gets the character position of the first character of the second line.

``` xojo
Var i As Integer
i = TextArea1.CharacterPosition(1)
```

This example is in the MouseDown event of the control. The event passes in the X,Y coordinates of the MouseDown event. The example gets the position of the character at the passed coordinates.

``` xojo
Var i As Integer
i = Me.CharacterPosition(x, y)
MessageBox(i.ToString)
Return True
```

<div id="textarea.close_method">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Close

**Close**

Closes a control.

Closing a control permanently removes the control from memory, making it impossible to access. You can close both non-indexed controls and indexed controls. When you close an indexed control, the indexes for the remaining controls will shift downward so that the indexes start with zero and are consecutive.

The following code closes the control. When this is executed from a visible control, the control disappears from the window.

``` xojo
Me.Close
```

<div id="textarea.copy">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Copy

**Copy**

Copies the selected text in the <span class="title-ref">TextArea</span> to the Clipboard, including the styled text information.

This example copies the selected text and places it on the Clipboard.

``` xojo
TextArea1.SelStart = 0
TextArea1.SelLength = 10
TextArea1.Copy
```

<div id="textarea.drawinto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.DrawInto

**DrawInto**(g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

Draws the contents of the RectControl into the specified `Graphics</api/graphics/graphics>` context. The parameters *x* and *y* are the coordinates of the top, left corner.

This method does not work with `HTMLViewer</api/deprecated/htmlviewer>` and `OpenGLSurface</api/deprecated/openglsurface>`.

This example draws the current control into the Graphics of a Picture and then displays it as the Backdrop of a Canvas:

``` xojo
Var p As New Picture(Me.Width, Me.Height)
Me.DrawInto(p.Graphics, 0, 0)
Canvas1.Backdrop = p
```

<div id="textarea.insertionposition">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.InsertionPosition

**InsertionPosition**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`) As `Integer</api/data_types/integer>`

Returns (as an `Integer</api/data_types/integer>`) returns the position of the insertion point closest to pixel coordinates X,Y relative to the control. The returned value is zero-based.

This example is in the MouseDown event of a <span class="title-ref">TextArea</span>. This event passes in the X,Y coordinates of the MouseDown event and the method returns the corresponding character position.

``` xojo
Var i As Integer
i = TextArea1.InsertionPosition(x, y)
MessageBox(i.ToString)
Return True
```

<div id="textarea.invalidate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Invalidate

**Invalidate**(\[EraseBackground As `Boolean</api/data_types/boolean>`\])

Similar to RefreshRect, but causes the specified region of the RectControl to be marked dirty and to be redrawn when the window contents need to be redrawn. The region to be redrawn is specified by the *X*, *Y*, *Width*, and *Height* parameters. This form of Invalidate was formerly called InvalidateRect.

The following code refreshes the control. EraseBackground defaults to `True</api/language/true>`.

``` xojo
Me.Invalidate(False)
```

<div id="textarea.linenumber">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LineNumber

**LineNumber**(CharPosition As `Integer</api/data_types/integer>`) As `Integer</api/data_types/integer>`

Returns (as an `Integer</api/data_types/integer>`) the line number in which the *CharacterPosition* character appears.

Characters are numbered consecutively with the first character numbered 1. The first line is numbered zero. Used with ScrollPosition, this lets you scroll the control to a particular place in the text.

The line number reflects line breaks from both hard line breaks in the text and soft line breaks caused by word-wrapping within the control.

Gets the line number for the character at position 100:

``` xojo
Var lineNum As Integer = TextArea1.LineNumber(100)
```

This example searches a <span class="title-ref">TextArea</span> using text provided in a TextField and then scrolls to the text in the \`TextArea\`:

``` xojo
Var searchText As String = TextField1.Text
Var position As Integer = InStr(TextArea1.Text, searchText)

If position > 0 Then
  TextArea1.VerticalScrollPosition = TextArea1.LineNumber(position)
Else
  ' InStr returns 0 if no match was found.
End If
```

<div id="textarea.paste">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Paste

**Paste**

Pastes the styled or unstyled text on the Clipboard into the editing area at the insertion point, adding the text to the existing text.

When pasting into a <span class="title-ref">TextArea</span>, if the text is styled, the style information is preserved.

This example pastes the contents of the Clipboard into TextArea2 at the insertion point.

``` xojo
TextArea2.Paste
```

<div id="textarea.refresh">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Refresh

**Refresh**(eraseBackground As `Boolean</api/data_types/boolean>`)

Repaints the portion specified of the contents of the control immediately.

Calling this frequently can cause the code executing to slow down. It is often preferable to call `RectControl.Invalidate<rectcontrol.invalidate>` instead.

Refresh the entire area:

``` xojo
Me.Refresh(False)
```

Refresh a portion of the area:

``` xojo
Me.Refresh(100, 150, 200, 300)
```

<div id="textarea.selectall">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelectAll

**SelectAll**

Selects all of the text in the control. If there is no text in the control, SelectAll does nothing.

This example selects all the text in the control.

``` xojo
TextArea1.SelectAll
```

<div id="textarea.setfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SetFocus

**SetFocus**

Gives the <span class="title-ref">TextArea</span> the focus, sending all keydown events to the <span class="title-ref">TextArea</span> and moving the cursor there.

<div id="textarea.styledtextprinter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.StyledTextPrinter

**StyledTextPrinter**(g As `Graphics</api/graphics/graphics>`, Width As `Integer</api/data_types/integer>`) As `StyledTextPrinter</api/printing/styledtextprinter>`

Used to create a `StyledTextPrinter</api/printing/styledtextprinter>` object for printing the <span class="title-ref">TextArea</span>'s text property as styled text.

The <span class="title-ref">TextArea</span>'s MultiLine property must be `True</api/language/true>` to support styled text printing. Returns a `StyledTextPrinter</api/printing/styledtextprinter>` object. *Width* (pixels) is width of printable area.

<div id="textarea.toggleselectionbold">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ToggleSelectionBold

**ToggleSelectionBold**

Reverses the bold style of the highlighted text.

<div id="textarea.toggleselectionitalic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ToggleSelectionItalic

**ToggleSelectionItalic**

Reverses the italic style of the highlighted text.

<div id="textarea.toggleselectionunderline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ToggleSelectionUnderline

**ToggleSelectionUnderline**

Reverses the underline style of the highlighted text.

## Event descriptions

<div id="textarea.close_event">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Close

**Close**

The control is about to close.

<div id="textarea.constructcontextualmenu">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ConstructContextualMenu

**ConstructContextualMenu**(Base As `MenuItem</api/deprecated/menuitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

This event is called when it is appropriate to display a contextual menu for the control.

This event handler is the recommended way to handle contextual menus because this event figures out whether the user has requested the contextual menu, regardless of how they did it. Depending on platform, it might be in the MouseUp or MouseDown event and it might be a right+click or by pressing the contextual menu key on the keyboard, for example.

*Base* is analogous to the menu bar for the contextual menu. Any items you add to *Base* will be shown as menu items. If you return `False</api/language/false>`, the event is passed up the parent hierarchy.

If you return `True</api/language/true>`, the contextual menu is displayed. The parameters *x* and *y* are the mouse locations. If the event was fired because of a non-mouse event, then *x* and *y* are both set to -1. See the example of a contextual menu in the following section.

The following ConstructContextualMenu event handler builds a menu with three menu items plus a submenu with three additional menu items.

``` xojo
' Add some items
base.AddMenu(New MenuItem("Test 1"))
base.AddMenu(New MenuItem("Test 2"))
base.AddMenu(New MenuItem("Test 3"))

' Add a Separator
base.AddMenu(New MenuItem(MenuItem.TextSeparator))

' Add a sub menu
Var submenu As New MenuItem("SubMenu")
submenu.AddMenu(New MenuItem("SubMenu Test 1"))
submenu.AddMenu(New MenuItem("SubMenu Test 2"))
submenu.AddMenu(New MenuItem("SubMenu Test 3"))
base.AddMenu(submenu)

' Add a Separator
base.AddMenu(New MenuItem(MenuItem.TextSeparator))

Return True
```

<div id="textarea.contextualmenuaction">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ContextualMenuAction

**ContextualMenuAction**(HitItem As `MenuItem</api/deprecated/menuitem>`) As `Boolean</api/data_types/boolean>`

Fires when a contextual menuitem *hitItem* was selected but the Action event and the MenuHandler for the menuitem did not handle the menu selection.

This event gives you a chance to handle the menu selection by inspecting the menuitem's Text or Tag properties to see which item was selected. Use this in conjunction with ConstructContextualMenu if you have not specified the Action event or the Menu Handler for the items on the contextual menu. See the example of a contextual menu in the examples for the **RectControl** class.

`Return</api/language/return>` `True</api/language/true>` if this event has handled the item the user chose from the contextual menu. Returning `False</api/language/false>` will cause the control's parent to execute its ContextualMenuAction event. This can be handy if you have the same contextual menu for several controls who share the same `Parent<rectcontrol.parent>` (several on the same window for example). By returning `False</api/language/false>` you can handle them all in a single event.

This simple event handler displays the value of the selected menu item.

``` xojo
If hitItem <> Nil Then MessageBox(hitItem.Value)
Return True
```

<div id="textarea.dragenter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.DragEnter

**DragEnter**(obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

Fires when the passed `DragItem</api/user_interface/desktop/dragitem>` enters the RectControl.

Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` from this event to prevent the drop from occurring.

The Action parameter specifies the drag action. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Class Constant                                                     |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

To restrict file drops to just folders (and not files), you can put this code in the DragEnter event:

``` xojo
If Not obj.FolderItem.IsFolder Then Return True
```

<div id="textarea.dragexit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.DragExit

**DragExit**(obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`)

Fires when the passed `DragItem</api/user_interface/desktop/dragitem>` exits the RectControl.

The *Obj* parameter is the item being dragged. The *Action* parameter specifies the drag action. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Constant                                                           |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

<div id="textarea.dragover">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.DragOver

**DragOver**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

Fires when the `DragItem</api/user_interface/desktop/dragitem>` is over the RectControl.

The *Obj* parameter is the object being dragged. The coordinates x and y are relative to the **RectControl**. Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` from this event to prevent the drop from occurring.

The *Action* parameter specifies the drag action, which is typically done by holding down a modifier key (Shift, Alt, Option, Command, etc.) while doing the drag. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Constant                                                           |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

<div id="textarea.dropobject">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.DropObject

**DropObject**(Obj As `DragItem</api/user_interface/desktop/dragitem>` Action As `Integer</api/data_types/integer>`)

The item represented by *Obj* has been dropped on the control.

The *Obj* parameter is the object being dragged. The *Action* parameter specifies the drag action. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

{\| class="genericTable" ! width=10% Class Constant 0 \| `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault 1 \| `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy 2 \| `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove 3 \| `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink }

The following DropObject event handler can handle either a dropped picture or a dropped file. The type of file that it can handle needs to have been specified in a call to AcceptFileDrop prior to the drop, for example, in the Open event.

``` xojo
If Obj.PictureAvailable Then
  Me.Image = obj.Picture
ElseIf Obj.FolderItemAvailable Then
  Me.Image = Picture.Open(obj.FolderItem)
End If
```

<div id="textarea.enablemenuitems">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.EnableMenuItems

**EnableMenuItems**

Indicates that the control has the focus and a menu is about to be displayed.

<div id="textarea.gotfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.GotFocus

**GotFocus**

The <span class="title-ref">TextArea</span> has received the focus and has a selection rectangle around it.

<div class="note">

<div class="title">

Note

</div>

On Macintosh, controls other than text fields and lists will accept focus only if the full keyboard access option is enabled in System Preferences/Keyboard.

</div>

<div id="textarea.keydown">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.KeyDown

**KeyDown**(Key As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

The user has pressed the *Key* passed while the `control</api/deprecated/rectcontrol>` has the focus.

How KeyDown works depends on the type of control.

**TextField and TextArea** Returning `True</api/language/true>` means the key is intercepted, preventing the key from actually reaching the control at all. This would be useful if you want to override the behavior of the tab key for example. Returning `False</api/language/false>` means the key reaches the control.

**All Other Controls** Returning `True</api/language/true>` prevents the KeyDown event on the parent control (usually the window) from executing. Returning `False</api/language/false>` results in the execution of the KeyDown event of the parent control.

<div id="textarea.keyup">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.KeyUp

**KeyUp**(Key As `String</api/data_types/string>`)

Fires when the passed *Key* is released in the RectControl that has the focus.

It is not guaranteed to be the same key that received the KeyDown event.

<div id="textarea.lostfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.LostFocus

**LostFocus**

The <span class="title-ref">TextArea</span> has lost the focus.

<div class="note">

<div class="title">

Note

</div>

On Macintosh, controls other than text fields and lists will accept and lose focus only if the full keyboard access option is enabled in System Preferences/Keyboard.

</div>

<div id="textarea.mousedown">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseDown

**MouseDown**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

The mouse button was pressed inside the control's region at the location passed in to *x*, *y*.

The coordinates *x* and *y* are local to the control, i.e. they represent the position of the mouse click relative to the upper-left corner or the <span class="title-ref">TextArea</span>.

`Return</api/language/return>` `True</api/language/true>` if you are going to handle the MouseDown. In such a case:

- The Action event, if any, will not execute and the state of the object will not change.
- You will receive the `MouseUp<textarea.mouseup>` event.

If you return False, the system handles the MouseDown so the `MouseUp<textarea.mouseup>` event handler does not get called.

The MouseDown event uses the `DragItem</api/user_interface/desktop/dragitem>` constructor when the user drags the contents of the control. It is:

``` xojo
Var d As DragItem
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
d.Picture = Me.Image
d.Drag ' Allow the drag
```

<div id="textarea.mouseenter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseEnter

**MouseEnter**

The mouse has entered the area of the control.

<div id="textarea.mouseexit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseExit

**MouseExit**

The mouse has left the area of the control.

<div id="textarea.mousemove">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseMove

**MouseMove**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`)

The mouse has moved within the control to the coordinates passed. The coordinates are local to the control, not to the window.

<div id="textarea.mouseup">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseUp

**MouseUp**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

The mouse button was released. Use the *x* and *y* parameters to determine if the mouse button was released within the control's boundaries.

<div class="note">

<div class="title">

Note

</div>

This event will not occur unless you return `True</api/language/true>` in the MouseDown event. The return value is ignored.

</div>

The parameters *x* and *y* are local coordinates, i.e. they represent the position of the mouse click relative to the upper-left corner or the <span class="title-ref">TextArea</span>. Mouse clicks that are released to the left or above a control are negative.

<div id="textarea.mousewheel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.MouseWheel

**MouseWheel**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`, DeltaX As `Integer</api/data_types/integer>`, DeltaY As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

The mouse wheel has been moved.

The parameters *X* and *Y* are the mouse coordinates relative to the control that has received the event. The parameters *DeltaX* and *DeltaY* hold the number of scroll lines the wheel has been moved horizontally and vertically, as defined by the operating system. *DeltaX* is positive when the user scrolls right and negative when scrolling to the left. *DeltaY* is positive when the user scrolls down and negative when scrolling up.

Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` to prevent the event from propagating further.

<div id="textarea.open">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.Open

**Open**

The control is about to be displayed. Use this event to initialize a control.

The Open event is called after the Constructor.

Be warned that initializing control property values using the Constructor instead of the Open event may result in those property values being overwritten by what is set in the Inspector. For best results, use the Open event for control initialization rather than the control Constructor.

If the control is supposed to handle drag and drop, you need to tell it which type of item it needs to be able to handle. The following example informs the control that pictures and files can be dropped on it. The type of the file it needs to support is specified via the File Types Editor.

``` xojo
Sub Open()
  Me.AcceptPictureDrop
  Me.AcceptFileDrop("JPEG")
End Sub
```

<div id="textarea.selchange">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.SelChange

**SelChange**

The range of characters highlighted has changed.

<div id="textarea.textchange">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.TextChange

**TextChange**

The Text property of the <span class="title-ref">TextArea</span> has been changed.

<div id="textarea.validationerror">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TextArea.ValidationError

**ValidationError**(InvalidText As `String</api/data_types/string>`, StartPosition As `Integer</api/data_types/integer>`)

The user has tried to enter a character that is prohibited by the <span class="title-ref">TextArea</span>'s Mask property.

*InvalidText* is the entire character string up to and including the invalid text. *StartPosition* is the starting character position in which the actual invalid text was entered. The first character is numbered 1. If no code is provided in this event and a validation error occurs, you will hear the default system beep.

## Notes

Styled text can be printed using the `StyledTextPrinter</api/printing/styledtextprinter>` class. Styled text can also be managed independently of a <span class="title-ref">TextArea</span> using the `StyledText</api/text/styledtext>` class (see below for more information).

TextArea inherits from `TextEdit</api/deprecated/textedit>`, the base class for both <span class="title-ref">TextArea</span> and `TextField</api/deprecated/textfield>`. `TextField</api/deprecated/textfield>` is the single-line text control. `TextEdit</api/deprecated/textedit>` is an abstract class and it is not intended to be instantiated.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Working with styled text in textareas

In order to display styled text in a <span class="title-ref">TextArea</span>, the <span class="title-ref">TextArea</span>'s AllowStyledText property must be True.

The `SelectionBold<textarea.selectionbold>`, `SelectionTextColor<textarea.selectiontextcolor>`, `SelectionItalic<textarea.selectionitalic>`, and `SelectionUnderline<textarea.selectionunderline>` properties can be used to both set the style of the selected text and get the style of the selected text. These properties are set automatically at runtime when text is selected in a <span class="title-ref">TextArea</span>. To set the style, assign `True</api/language/true>` to the property. For example, if you want to add the bold style to the selected text in TextArea1, use this syntax:

``` xojo
TextArea1.SelectionBold = True
```

You can determine if the selected text is in a particular style using the same property. The following code plays a beep sound if the selected text is bold:

``` xojo
If TextArea1.SelectionBold Then
  System.Beep
End If
```

The `SelectionBold<textarea.selectionbold>`, `SelectionItalic<textarea.selectionitalic>`, and `SelectionUnderline<textarea.selectionunderline>` properties will be `True</api/language/true>` if all of the selected characters are in the style being checked. Otherwise, these properties will be `False</api/language/false>`.

Getting and setting the selected text font and font size work the same way using the `SelectionFontName<textarea.selectionfontname>` and `SelectionFontSize<textarea.selectionfontsize>` properties. To set the font of the selected text, set the `SelectionFontName<textarea.selectionfontname>` property to the name of the font. If the selected text uses more than one font, SelTextFont will be an empty string. If the selected text has more than one font size, the `SelectionFontSize<textarea.selectionfontsize>` property will be zero.

If the selected text has more than one style, font, or size, you can select individual characters using the SelStart and SelLength properties to determine which styles, fonts, and sizes are in use. Please note that if a <span class="title-ref">TextArea</span> contains more than one style, font, or font size and you reassign the value of the Text property, you will lose the styled formatting of the text substrings. All the text will then be styled uniformly. To update the text in a styled <span class="title-ref">TextArea</span>, it is safest to use the `SelectionStart<textedit.selectionstart>`, `SelectionLength<textedit.selectionlength>`, and `SelectedText<textedit.selectedtext>` properties to update text selections.

You can also get and set the color of the selected text using the `SelectionTextColor<textarea.selectiontextcolor>` property. for example, the following code checks to see if the selected text is white and if it is, sets it to black:

``` xojo
Var white, black As Color
white =Color.RGB(255, 255, 255)
black =Color.RGB(0, 0, 0)
If TextArea1.SelectionTextColor = White Then
  TextArea1.SelectionTextColor = Black
End If
```

To print styled text in a <span class="title-ref">TextArea</span>, use the StyledTextPrinter method to create a `StyledTextPrinter</api/printing/styledtextprinter>` object and then use the StyledTextPrinter's DrawBlock method. See the description of `StyledTextPrinter</api/printing/styledtextprinter>` for an example.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Execution order of menuhandlers

The intrinsic control menu handlers (such as <span class="title-ref">TextArea</span>.SelectAll) are handled after any user-defined menu handlers on the <span class="title-ref">TextArea</span> subclass (if it was subclassed). This means that if you have a SelectAll handler on the Window of the <span class="title-ref">TextArea</span>, it will no longer be called when the <span class="title-ref">TextArea</span> has focus, because the <span class="title-ref">TextArea</span> will now handle it first. In this situation, create a <span class="title-ref">TextArea</span> subclass that defines its own SelectAll handler, and handle the desired behavior there.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Text selection and copying

The <span class="title-ref">TextArea</span> gets text selection and copy features by default without you having to do anything.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Using the styledtext class

With the `StyledText</api/text/styledtext>` class, you can manage styled text independently of a <span class="title-ref">TextArea</span>. The styled text is contained in the Text property of the `StyledText</api/text/styledtext>` object and its style attributes can be set via its Bold, Italic, Underline, Font, Size, and TextColor methods.

When you create a `StyledText</api/text/styledtext>` object from the contents of a <span class="title-ref">TextArea</span>, the object that is returned is an alias, not a copy of the text. Therefore, subsequent changes to the `StyledText</api/text/styledtext>` object affect the contents of the <span class="title-ref">TextArea</span>. Consider the following example:

``` xojo
Var t As StyledText
t = TextArea1.StyledText
t.Text = "This is the new TextArea text."
t.Bold(0, 4) = True
```

The assignment statement changes the contents of the <span class="title-ref">TextArea</span> and the last line sets the first word in the new text to Bold.

To display the styled text, you can assign the styled text object to the <span class="title-ref">TextArea</span>'s StyledText property. Any programmatic changes to style attributes that you make while the styled text is displayed will update immediately.

Since the <span class="title-ref">TextArea</span> has its own properties for getting and setting style attributes for selected text, those attributes are respected by the `StyledText</api/text/styledtext>` object while it is displayed in the <span class="title-ref">TextArea</span>.

For more information, see the `StyledText</api/text/styledtext>` class.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Masks

Use the Mask property to filter user input on a character-by-character basis and add formatting characters. For example, a mask for a Telephone number field can add parentheses, spaces, and dashes as literals, that are used for formatting, and the digit mask symbol '#' to restrict entry to numbers only.

The following table shows the characters that you can use to define a mask.

| Mask Character | Description                                                                                                                                                 |
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| \#             | The single digit placeholder. Entry optional. If this position is left blank in the mask, it will be rendered as a space. Plus and minus signs are allowed. |
| .              | Decimal placeholder.                                                                                                                                        |
| ,              | Thousands separator.                                                                                                                                        |
| :              | Time separator.                                                                                                                                             |
| /              | Date separator.                                                                                                                                             |
|                | Mask escape character.                                                                                                                                      |
| &              | Character or space placeholder.                                                                                                                             |
| C              | Character or space placeholder, where entry is optional. It operates like the '&' placeholder.                                                              |
| \>             | Convert all the characters that follow to uppercase.                                                                                                        |
| \<             | Convert all the characters that follow to lowercase.                                                                                                        |
| A              | Alphanumeric character placeholder, where entry is mandatory.                                                                                               |
| a              | Alphanumeric character placeholder, where entry is optional.                                                                                                |
| 0              | Any single digit between 0 and 9. Entry is required.                                                                                                        |
| 9              | Digit or space where entry is optional.                                                                                                                     |
| ?              | Alphabetic placeholder. Entry is optional.                                                                                                                  |
| L              | Alphabetic placeholder. Entry is required.                                                                                                                  |
| Any literal    | All other symbols are displayed as literals for formatting purposes.                                                                                        |
| ~              | Reserved for future use. If you use "~" it will trigger an exception error. Use ~ instead.                                                                  |

Here are some examples:

``` xojo
TextArea1.ValidationMask = "###-##-####"  //US Social Security number
TextArea1.ValidationMask = "(###) ###-####"  //US Phone number, with area code
```

If the user tries to enter a character that is prohibited by the mask, a `ValidationError<textarea.validationerror>` event occurs. The character that the user attempted to enter and the character position is passed to the `ValidationError<textarea.validationerror>` event, where you can handle the keystroke as you like.

To cancel the Mask, set it to the empty string:

``` xojo
TextArea1.ValidationMask = ""
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Adding text to a textarea

When adding text to a <span class="title-ref">TextArea</span>, you may notice some flicker as the <span class="title-ref">TextArea</span> is redrawn to show the new text. This will happen if you appended the Value property of the <span class="title-ref">TextArea</span> like this:

``` xojo
TextArea1.Text = TextArea1.Text + "my new text"
```

This occurs because the entire contents of the <span class="title-ref">TextArea</span> has to be redrawn. To avoid this flicker, call the `AddText<textedit.addtext>` method instead. Pass it the text to be appended. For example, this code reads an external text file into a <span class="title-ref">TextArea</span> using the `Read</api/files/readable>` method of the `Readable</api/files/readable>` class interface. The text is read in groups of 1000 characters until the end-of-file is reached.

``` xojo
Var f As FolderItem
Var i As Integer
Var stream As BinaryStream
f = FolderItem.ShowOpenFileDialog(FileTypes1.Text) ' file type defined in File type set
If f <> Nil Then
  stream = BinaryStream.Open(f, False)
  Do
    TextArea1.AddText(stream.Read(1000, Encodings.UTF8))
  Loop Until stream.EndOfFile
  stream.Close
End If
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Text encoding

TextAreas store all text internally in Unicode, which is able to represent a mixture of characters from different writing systems. When you extract the text via the `Text<textedit.text>` or `SelectedText<textedit.selectedtext>` properties, this text is returned in UTF-8.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Using class constants

The following class constants are available to set paragraph alignments. Set the alignment of the entire contents of the <span class="title-ref">TextArea</span> by assigning a constant to the Alignment property.

| Value | Class Constant |
|-------|----------------|
| 0     | AlignDefault   |
| 1     | AlignLeft      |
| 2     | AlignCenter    |
| 3     | AlignRight     |

For example, the following code in the Pressed event of a control array sets the alignment of the text in a <span class="title-ref">TextArea</span>. The Pressed event is passed an index parameter that indicates which control was clicked.

``` xojo
Sub Pressed (Index As Integer)
Select Case Index
Case 0
  TextArea1.TextAlignment = TextAlignments.Default
Case 1
  TextArea1.TextAlignment = TextAlignments.Left
Case 2
  TextArea1.TextAlignment = TextAlignments.Center
Case 3
  TextArea1.TextAlignment = TextAlignments.Right
End Select
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Drag and drop

Dragging text between different TextAreas on a Window is supported automatically. Use the DragEnter, DragExit, DragOver and DropObject for more sophisticated handling of drag and drop.

## Compatibility

All project types on all supported operating systems.

## See also

`TextEdit</api/deprecated/textedit>` parent class; `Font</api/graphics/font>`, `System.FontCount<system.fontcount>` functions; `Paragraph</api/text/paragraph>`, `Range</api/text/range>`, `StyleRun</api/text/stylerun>`, `StyledText</api/text/styledtext>`, `StyledTextPrinter</api/printing/styledtextprinter>`, `TextEdit</api/deprecated/textedit>`, `TextField</api/deprecated/textfield>` classes.
