Text Field - Maple Help

Maplets[Elements]

 TextField
 define a single line text field
 define a single line password field

Parameters

 opts - equation(s) of the form option=value where option is one of background, cursor, editable, enabled, focus, font, foreground, halign, onchange, popupmenu, reference, tooltip, value, visible, or width; specify options for the TextField or PasswordField element refID - name or string; reference to the element

Description

 • The TextField window body element defines a text field, which is a single line text box, in a Maplet application.
 • The PasswordField window body element is identical to a text field, except that the "*" character is displayed in place of the actual content of the field.

 • The TextField and PasswordField  element features can be modified by using options. To simplify specifying options in the Maplets package, certain options and contents can be set without using an equation. The following table lists elements, symbols, and types (in the left column) and the corresponding option or content (in the right column) to which inputs of this type are, by default, assigned.

 Elements, Symbols, or Types Assumed Option or Content Font element font option left, center, or right halign option positive integer width option PopupMenu element popupmenu option string or symbol value option

 • A TextField or PasswordField element can contain Action or command elements to specify the onchange option, a Font element to specify the font option, and a PopupMenu element to specify the popupmenu option.
 • A TextField or PasswordField element can be contained in a Maplet or BoxLayout element, or Maplet element in a nested list representing a box layout.
 • The following table describes the control and use of the TextField and PasswordField element options.
 An x in the I column indicates that the option can be initialized, that is, specified in the calling sequence (element definition).
 An x in the R column indicates that the option is required in the calling sequence.
 An x in the G column indicates that the option can be read, that is, retrieved by using the Get tool.
 An x in the S column indicates that the option can be written, that is, set by using the SetOption element or the Set tool.

 Option I R G S append* x background x x x cursor x x x editable x x x enabled x x x focus x font x x x foreground x x x halign x x x onchange x popupmenu x reference x tooltip x x x value x x x visible x x x width x x x

 * append appends to the end of the text in the text/password field. Its syntax is refID(append)="text", where refID is a reference to the text field.
 • The opts argument can contain one or more of the following equations that set Maplet application options.
 background = color
 The color of the highlights of the text/password field.  This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
 cursor = nonnegint
 The position of the cursor in the text/password field, where the position at the start of the text/password field before all text is assigned as zero. Setting to any value larger than the number of characters in the field positions the cursor at the end of the text.
 editable = true or false
 Whether the field can be edited by the user. This option should be set to false for output fields. If editable = false, the text/password field is not editable, independent of the setting of the editable option. By default, the value is true.
 enabled = true or false
 Whether a text/password field can be highlighted.  If enabled is set to false, the field is dimmed, and any action associated with it cannot be initiated.  By default, the value is true.
 focus = true
 Setting this to true causes the text/password field to obtain focus for the Maplet application.
 font = Font element or reference to a Font element (name or string)
 The text font in the text/password field.
 foreground = color
 The face color of the text/password field.
 halign = left, center, or right
 The horizontal alignment of the text/password field.  By default, the value is left.
 onchange = Action or command element, or reference to an Action element (name or string)
 The action that occurs when the user changes the value of the text/password field and makes that field lose focus.  The action does not occur when the user presses ENTER.
 The popup menu or reference to a popup menu for the text/password field.  The default entries for any popup menu are Cut, Copy, Paste, Delete, and Select All when the option editable is true and Copy and Select All when the option editable is false.  Any entries given by this option are appended to the default entries.
 reference = name or string
 A reference to the TextField or PasswordField element.
 If the reference is specified by both an index, for example, TextField[refID], and a reference in the calling sequence, the index reference takes precedence.
 tooltip = string or symbol
 The text that appears in the tooltip help window.
 value = anything
 The default value of the field.  If the value is not a string, it is converted to one by using $\mathrm{sprintf}\left("%a",\mathrm{value}\right)$. By default, the value is empty.
 visible = true or false
 Whether the field is visible to the user.  By default, the value is true.
 width = posint
 The field width in characters.  By default, the value is 20.

Examples

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left[\left["Enter your name:",\mathrm{TextField}\left['\mathrm{IB1}'\right]\left(30\right)\right],\left[\mathrm{Button}\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{IB1}'\right]\right)\right),\mathrm{Button}\left("Cancel",\mathrm{Shutdown}\left(\right)\right)\right]\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

This Maplet application uses the Set function to append new text to the text field.

 > G:=proc() Maplets:-Tools:-Set('TF1' ('append') = " and on") end proc:
 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet2}≔\mathrm{Maplet}\left(\mathrm{Window}\left('\mathrm{layout}'='\mathrm{BL1}'\right),\mathrm{BoxLayout}\left['\mathrm{BL1}'\right]\left(\mathrm{BoxCell}\left('\mathrm{hscroll}'='\mathrm{always}',\mathrm{TextField}\left['\mathrm{TF1}'\right]\left("And on",100\right)\right),\mathrm{BoxCell}\left(\mathrm{Button}\left("Append",\mathrm{Action}\left(\mathrm{Evaluate}\left('\mathrm{function}'='G\left(\right)'\right)\right)\right)\right),\mathrm{BoxCell}\left(\mathrm{Button}\left("Close",\mathrm{Shutdown}\left(\right)\right)\right)\right)\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet2}\right)$