Maplets[Elements]
SetOption
set an option value in a Maplet application element
Calling Sequence
Parameters
Description
Examples
SetOption(opts, argument)
opts
-
equation(s) of the form option=value where option is one of `option`, target, or value; specify options for the SetOption element
argument
(optional) Argument element; specifies source of the value to assign to target element option (cannot be used if value option is included)
The SetOption command element sets the value of an option in a specified element. The value of the attribute can be specified by using the value option, or by including an Argument element. Refer to individual Element help pages or see Maplets/ElementOptions to determine the element options with which SetOption can be used.
The distinction between Set and SetOption is that Set is used within a procedure and SetOption is used within a Maplet application. Element options that can be set by using Set can also be set by using SetOption.
The argument option specifies a reference to an element. The value of the value option for this element is assigned to the element referenced by target.
The SetOption 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
name or string equated to anything
target and value options, respectively
The SetOption element uses additional simplifications. These simplifications are described in the following table where ref is a reference, opt is a symbol (an option for the element), and the right side is any accepted value for the specified option opt for the Maplet application element referenced by ref. The following table lists the simplified equation (in the left column) and its corresponding interpretation (in the right column).
Simplified Equation
Interpretation
ref = anything
target = ref, value = anything
ref(opt) = anything
target = ref, `option` = opt, value = anything
A SetOption element can contain an Argument element to specify the value option.
A SetOption element can be contained in a Maplet element; in an equation for the onapprove, oncancel, onchange, onclick, ondecline, or onstartup option for an element; or wrapped in an Action element as a parameter in an element that accepts an onchange or onclick option without an equation.
The following table describes the control and use of the SetOption 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
`option`
x
target
value
The opts argument can contain one or more of the following equations that set Maplet application options.
`option` = symbol
The option of the target element to update. By default, the value option if it exists.
target = reference to an element (name or string)
A reference to the element to update.
value = string
The value assigned to the target element `option` option. By default, this value is the empty string "".
with⁡MapletsElements:
maplet1≔Maplet⁡Label⁡caption=Enter an expression,Input Field:,TextFieldB1⁡20,Output Field:,TextFieldB2⁡20,editable=false,Button⁡Clear 1st Field,SetOption⁡target=B1,value=,Button⁡Copy to 2nd Field,SetOption⁡target=B2,Argument⁡B1,Button⁡Return 2nd Field,Shutdown⁡B2:
MapletsDisplay⁡maplet1
This Maplet application uses the SetOption with the reference shortcut.
maplet2≔Maplet⁡Label⁡caption=Enter an expression,Input Field:,TextFieldTF1⁡20,Button⁡Change Font,SetOption⁡TF1⁡font=F1,Button⁡Change Color,SetOption⁡TF1⁡background=red,Button⁡Exit,Shutdown⁡TF1,FontF1⁡courier,size=14:
MapletsDisplay⁡maplet2
See Also
Maplets/CommandElements
Maplets/ElementOptions
Maplets[Display]
Maplets[Elements][Action]
Maplets[Elements][Argument]
Maplets[Elements][Button]
Maplets[Elements][Label]
Maplets[Elements][Maplet]
Maplets[Elements][Shutdown]
Maplets[Elements][TextField]
Maplets[Tools][Get]
Maplets[Tools][Set]
Overview of Maplet Applications
Download Help Document