# Multi Edit

### Overview

A MultiEdit is a field used to show or alter text in various disposed line

<div align="left"><img src="/files/-LaaJUfmY7JYeolZkIR_" alt=""></div>

### Source Code

{% code title="MultiEditSample.java" %}

```java
import totalcross.sys.Settings;
import totalcross.ui.MainWindow;
import totalcross.ui.MultiEdit;

public class MultiEditSample extends MainWindow {
	public MultiEditSample() {
		setUIStyle(Settings.MATERIAL_UI);
		Settings.uiAdjustmentsBasedOnFontHeight = true;
	}

	public void initUI() {
		MultiEdit multiEdit = new MultiEdit();
		multiEdit.caption = "MultiEdit";
		add(multiEdit, LEFT + 100,CENTER, FILL - 100, DP + 48);
	}
}
```

{% endcode %}

### Attributes

| Type        | Name       | Description                                                         |
| ----------- | ---------- | ------------------------------------------------------------------- |
| **boolean** | autoSelect | When true, the text will be selected when the MultiEdit is foccused |
| **String**  | caption    | The MultiEdit's placeholder text                                    |
| **boolean** | justify    | Justify the text when the MultiEdit is not editable                 |
| **boolean** | drawDots   | If true, a dotted line will be drawn on each line                   |

### Methods

| Type            | Name                                                        | Description                                                                                                                                                                                 |
| --------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Constructor** | MultEdit( )                                                 | Creates a MultiEdit for user input with the default size and spacing                                                                                                                        |
| **Constructor** | MultiEdit(int rowCount, int spaceBetweenLines)              | Creates a MultiEdit for user input with the passed row quantity and line spacing.                                                                                                           |
| **Constructor** | MultiEdit(String mask, int rowCount, int spaceBetweenLines) | Creates a MultiEdit for user input with the passed row quantity and line spacing, but with a mask.                                                                                          |
| **void**        | setEditable(boolean on)                                     | Will enable or disable the MultiEdit. Can be used as a way to make sure the user don't modify something that was already saved on server and can't be modified without proper authorization |
| **String**      | getText( )                                                  | Returns the text within the MultiEdit                                                                                                                                                       |
| **void**        | setMaxLength(int length)                                    | Is used to limit the characters number the user can digit on the text field                                                                                                                 |

### **References**

* See the [MultiEdit Java Docs ](https://rs.totalcross.com/doc/totalcross/ui/MultiEdit.html)for more information.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.totalcross.com/documentation/components/multi-edit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
