Text Box - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Maplets[Elements]

  

TextBox

  

define a text box for input or output

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

TextBox(opts)

TextBox[refID](opts)

Parameters

opts

-

equation(s) of the form option=value where option is one of background, cursor, editable, enabled, focus, font, foreground, height, onchange, popupmenu, reference, tooltip, value, visible, width, or wrapped; specify options for the TextBox element

refID

-

name or string; reference to the element

Description

• 

The TextBox window body element defines a text box for input or output in a Maplet application.

  

 

• 

The TextBox 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

range of positive integers

height and width options, respectively

PopupMenu element

popupmenu option

refID

reference option

string or symbol

value option

 

 

• 

A TextBox 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 TextBox element can be contained in a Maplet or BoxLayout element, or Maplet element in a nested list representing a box layout.

• 

If the text in a TextBox exceeds the size of the box, a vertical scroll bar is automatically displayed.

• 

The following table describes the control and use of the TextBox 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

appendline*

 

 

 

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

height

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

wrapped

x

 

x

x

 

 

 

 

 

  

* append appends to the end of the text in the text box. Its syntax is refID(append)="text", where refID is a reference to the text box.

  

* appendline appends to the end of the text in the text box, then adds a new line. Its syntax is refID(appendline)="text", where refID is a reference to the text box.

• 

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 box.  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 box, where the position at the start of the text box before all text is assigned as zero. For multi-line text, a newline counts as a single character. Setting to any value larger than the number of characters in the text box positions the cursor at the end of the text.

  

 

  

editable = true or false

  

Whether the text box can be edited by the user. This option should be set to false for output boxes. If editable = false, the text box is not editable, independent of the setting of the editable option. By default, the value is true.

  

 

  

enabled = true or false

  

Whether a text box can be highlighted.  If enabled is set to false, the text box 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 box 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 box.

  

 

  

foreground = color

  

The foreground color of the text box.

  

 

  

height = posint

  

The text box height in characters.  The default height is 1 character.

  

 

  

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 box and makes the text box 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 box.  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 specified by this option are appended to the default entries.

  

 

  

reference = name or string

  

A reference to the TextBox element.

  

If the reference is specified by both an index, for example, TextBox[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 = string or symbol

  

The initial value of the text box. By default, the value is empty.

  

 

  

visible = true or false

  

Whether the text box is visible to the user.  By default, the value is true.

  

 

  

width = posint

  

The text box width in characters.  The default width is 20 characters.

  

 

  

wrapped = true or false

  

Whether the content of the text box wraps to the next line. By default, the value is true.

Examples

A Maplet application that requires the user to enter text. Then the text is split into its individual words.

withMapletsElements:

mapletMapletEnter some text: ,BoxCellTextBoxIB13..30,ButtonOK,ShutdownIB1,ButtonCancel,Shutdown:

resultMapletsDisplaymaplet

`if`typeresult,string,StringToolsSplitresult1,NULL

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

G:=proc() Maplets:-Tools:-Set('TB1' ('appendline') = "and more") end proc:

withMapletsElements:

maplet2MapletTextBoxTB1Some text ,ButtonAppend,ActionEvaluatefunction=G,ButtonClose,Shutdown:

MapletsDisplaymaplet2

See Also

Maplets/CommandElements

Maplets/WindowBodyElements

Maplets[Display]

Maplets[Elements]

Maplets[Elements][Action]

Maplets[Elements][BoxCell]

Maplets[Elements][Button]

Maplets[Elements][Evaluate]

Maplets[Elements][Font]

Maplets[Elements][Maplet]

Maplets[Elements][PopupMenu]

Maplets[Elements][SetOption]

Maplets[Elements][Shutdown]

Maplets[Elements][TextField]

Maplets[Tools][Get]

Maplets[Tools][Set]

Overview of Maplet Applications

plot[color]

proc

StringTools[Split]

type