Text Area Component - Maple Help

Home : Support : Online Help : Programming : Document Tools : Embedded Components : TextAreaComponent

Text Area Component

Insert a text area in a Standard Maple worksheet or document.

Description

 • 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, right-click (Control-click for Macintosh) the text area, and then select Edit Content Changed Action 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 TextArea Properties. To open the TextArea Properties, right-click (Control-click for Macintosh) the text area, and then select Component Properties. 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.
 Component Palette Image

Text Area Properties

 • The following table describes the control and use of the text area component options.
 An x in the G column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.
 An x in the S column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.

Option                G  S  Option Type

editable              x  x  true or false
enabled               x  x  true or false
fillcolor             x  x  color

password              x  x  true or false
showBorders           x  x  true or false
tooltip               x  x  string
value                 x  x  string
visible               x  x  true or false
visibleCharacterWidth x  x  positive integer
visibleRows           x  x  positive integer
wrapping              x  x  true or false

 editable
 Indicates whether the contents are editable. By default, the value is true.
 enabled
 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.
 fillcolor
 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.
 fontcolor
 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.
 showBorders
 Specifies if the border of the component is visible. By default, the value is true.
 tooltip
 The text that appears when the user hovers the mouse over the text area.
 value
 The content in the text area.
 visible
 Specifies if the text box is visible. By default, the value is true.
 visibleCharacterWidth
 The number of visible characters that appear in a row. By default, the value is 10.
 visibleRows
 The number of rows that appear in the text area. By default, the value is 1.
 In a multi-line text area component (when visbleRows is greater than 1), if the number of rows of content exceeds the number of visible rows, a scroll bar appears.
 wrapping
 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.

Text Area Component Example

 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:

 1 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.
 2 Right-click the Text Area component, and then select Component Properties.
 3 Click the Edit button beside Contents.
 4 In the Contents dialog, enter Int(x^2/sin(x), x), and then click OK.
 5 Change the value for the Visible Character Width to 25, and then click OK.

To display the contents of the text area as 2-D Math in the math expression component:

 1 Right-click (Control-click for Macintosh) the text area, and then select Edit Content Changed Action.

This launches the Code Editor dialog with preset statements and additional information on how to program actions between embedded components.

 2 Before the end use; statement in the dialog, enter the following command:

Do(%MathContainer0=%TextArea0);

Note: Ensure the names of the components are correct (that is, that they match the Name fields for their components).

 3 From the File menu, select Save Code to accept all changes.
 4 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.

You can verify the syntax of the embedded component action by executing the command in the worksheet.

 > DocumentTools[Do](%MathContainer0 = %TextArea0);
 ${∫}\frac{{{x}}^{{2}}}{{\mathrm{sin}}{}\left({x}\right)}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (4.1)