The XdevTextArea is a multi-row input field. The XdevTextArea is a form component and can be persisted via the XdevFieldGroup
Important properties:
Rows - Defines the height of a form component in rows. A row is roughly equal to the height of a character. This setting is only relevant if Toolbox> Height is set to ? (Undefined) or you are using an AbsoluteLayout.
Wordwrap - Automatically performs a word wrap. Without word wrap, a horizontal scrollbar is displayed.
TextChangeEventMode - Determines when exactly the textChange event is triggered.
LAZY - Default setting. The event is triggered only if there is a timeout after the last change. The length of the timeout can be defined in Properties > Misc > TextChangeTimeout.
- EAGER - The event is triggered at each keystroke.
- TIMEOUT - The event is triggered only if there is a timeout after the last change.
TextChangeTimeout - Defines the length of the timeout, after which the textChange event is triggered, in milliseconds.
Important events:
textChange - Is triggered after a brief delay following changes to the content, for example adding or deleting characters. The exact time at which the event is triggered can be defined under Properties > Misc > TextChangeEventMode.
Misc
valueChange - Is triggered after changes to the content, mainly by adding or deleting characters, however only if the UI component loses the focus.
Examples:
Allocate content - Allocates a text as string to the XdevTextArea. This may trigger a textChange or valueChange event.
This is the simplest type of allocation. However, it is 100% functional only with strings. When this method is used, diverse converters deliver an unsatisfactory output.textArea.setValue("Hello 123 !!!");
Allocate content - Allocates a specific value to the XdevTextArea. As an example, a BigDecimal data type for currencies or Double for specific formatting with decimal places, etc.
When this type of allocation is employed, the delivered converter functions optimally.Property<BigDecimal> betrag = new ObjectProperty<BigDecimal>(new BigDecimal(100), BigDecimal.class); textArea.setPropertyDataSource(betrag);
or
Property<Double> betrag = new ObjectProperty<Double>(new Double(100), Double.class); textArea.setPropertyDataSource(betrag);
Change content - If a property is already allocated to the XdevTextArea (refer to example 2), the value can be changed directly in the property in this abbreviated form without setting a new data source.
textArea.setConvertedValue(200);
Read content
String content = textArea.getValue();
Delete content - Deletes the entire content in XdevTextArea. This may trigger a textChange or valueChange event.
textArea.clear();
Set cursor - Set the cursor to a specific position. The position is specified as an int value.
textArea.setCursorPosition(10);
Set focus: Allocates the focus to the XdevTextArea. This can trigger a focus event, if necessary.
textArea.focus();
Select content
textArea.selectAll();
Go to XdevTextArea Javadoc
Tipps:
Convert string to integer: If the content of the XdevTextArea is an integer, with which you want to calculate further, you must convert the string with the Integer.parseInt(String s) method into an integer. The method accepts only a string with characters. Only the characters + and - at the start of the value are permitted.
String content = textArea.getValue(); Integer value = Integer.parseInt(content);
Convert integer to string: When you want to assign an integer to an XdevTextArea, you must first convert it into a string.
Integer value = 100; String content = Integer.toString(value); textArea.setValue(content);