define a single line text field - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Maplets : Elements : Window Body Elements : Maplets/Elements/TextField

Maplets[Elements][TextField] - define a single line text field

Maplets[Elements][PasswordField] - define a single line password field

Calling Sequence

TextField(opts)

TextField[refID](opts)

PasswordField(opts)

PasswordField[refID](opts)

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.

  

 

  

popupmenu = PopupMenu element or reference to a PopupMenu element (name or string)

  

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 sprintf%a,value. 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

withMaplets[Elements]:

maplet:=MapletEnter your name: ,TextField'IB1'30,ButtonOK,Shutdown'IB1',ButtonCancel,Shutdown:

Maplets[Display]maplet

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:

withMaplets[Elements]:

maplet2:=MapletWindow'layout'='BL1',BoxLayout'BL1'BoxCell'hscroll'='always',TextField'TF1'And on,100,BoxCellButtonAppend,ActionEvaluate'function'='G',BoxCellButtonClose,Shutdown:

Maplets[Display]maplet2

See Also

Maplets/CommandElements, Maplets/WindowBodyElements, Maplets[Display], Maplets[Elements], Maplets[Elements][Action], Maplets[Elements][BoxCell], Maplets[Elements][BoxLayout], Maplets[Elements][Button], Maplets[Elements][Evaluate], Maplets[Elements][Font], Maplets[Elements][Maplet], Maplets[Elements][PopupMenu], Maplets[Elements][SetOption], Maplets[Elements][Shutdown], Maplets[Elements][TextBox], Maplets[Elements][Window], Maplets[Tools][Get], Maplets[Tools][Set], Overview of Maplet Applications, plot[color], sprintf


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam