Text Area Component
Insert a text area in a Standard Maple worksheet or document.
Description
Component Palette Image
Text Area Properties
Text Area Component Example
The text area component performs an action or a series of actions to communicate with other embedded components when the contents in the text area change.
To perform an action when the contents in the text area change, click the text area, and then select Edit Content Changed Code to open the Code Editor dialog for the text area. Enter the commands you want to perform in the Code Editor dialog.
You need to specify one or more embedded components that will display the output when the text area content changes. For more information, see the Text Area Component Example on this page.
The text area component is customized by setting options in the Text Area context panel. To open the Text Area context panel, click the text area. Actions are associated with components using routines in the DocumentTools package.
The Name property is used to reference the text area when using the routines from the DocumentTools package.
The Automatic Text Wrapping option is only available for multi-line text area components (when the number of visible rows is greater than 1).
The Password option only changes the visibility of the input characters in the text area by displaying them as black circles. You can still retrieve the text using DocumentTools[Do] or DocumentTools[GetProperty], and there is no encryption on the retrieved text. The Password option is not available for multi-line text areas.
The following table describes the control and use of the text area component options.
An x in the Get column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.
An x in the Set column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.
Option
Get
Set
Option Type
editable
x
true or false
enabled
fillcolor
color
fontcolor
password
showborders
tooltip
string
type
value
visible
visiblecharacterwidth
positive integer
visiblerows
wrapping
Indicates whether the contents are editable. By default, the value is true.
Indicates whether the component is enabled. If enabled is set to false, the text area is dimmed and you cannot modify, select, or copy its contents. (If enabled is set to false, the value of editable is ignored.) By default, the value is true.
Specifies the background color of the component. The color can be given by RGB values (a list of three integers between 0 and 255) or a string representing a color name, for example, [255,0,0] or “Red”. The default value is [255,255,255] which corresponds to white.
Specifies the font color of the component. The default value is [0,0,0] which corresponds to black.
Setting this option to true causes input to be displayed as black circles in place of the actual contents of the field.
Specifies if the border of the component is visible. By default, the value is true.
The text that appears when the user hovers the mouse over the text area.
The type of the component. This returns "TextArea".
The content in the text area.
Specifies if the text box is visible. By default, the value is true.
The number of visible characters that appear in a row. By default, the value is 10.
The number of rows that appear in the text area. By default, the value is 1.
In a multi-line text area component (when visiblerows is greater than 1), if the number of rows of content exceeds the number of visible rows, a scroll bar appears.
Indicates whether content on one line of the text area which exceeds the horizontal space will automatically wrap to the next line. By default, the value is true.
Note: To interact with the examples provided below, open this help page as a worksheet.
This example uses a Text Area component and a Mathematical Expression component. When you enter an expression in the text area, the expression is displayed as 2-D Math in the math expression component.
To insert the components and enter the defaults contents for the text area:
Insert a Text Area component and a Mathematical Expression component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.
Click in the text area component and type Int(x^2/sin(x), x);.
Click outside the Text Area component.
Change the value for the Visible Character Width to 25.
To display the contents of the text area as 2-D Math in the math expression component:
Click the text area, and then select Edit Content Changed Code.
This launches the Code Editor dialog.
Before the end use; statement in the dialog, enter the following command:
SetProperty("MathContainer0", value, parse(GetProperty("TextArea0", value)));
Note: Ensure the names of the components are correct (that is, that they match the Name fields for their components).
Click or from the File menu, select Save Code to accept all changes.
From the File menu, select Close Code Editor.
Enter an expression in the text area. When you press Enter or click anywhere in the worksheet outside of the text area, the expression you entered displays as 2-D Math in the math expression component.
with(DocumentTools):
You can verify the syntax of the embedded component action by executing the command in the worksheet.
See Also
DocumentTools
DocumentTools[GetProperty]
DocumentTools[SetProperty]
EmbeddedComponents
Download Help Document