 Set Option - Maple Help

Maplets[Elements]

 SetOption
 set an option value in a Maplet application element Calling Sequence SetOption(opts, argument) Parameters

 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) Description

 • 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 x x value x

 • 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 "". Examples

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet1}≔\mathrm{Maplet}\left(\left[\left[\mathrm{Label}\left('\mathrm{caption}'="Enter an expression"\right)\right],\left["Input Field:",\mathrm{TextField}\left['\mathrm{B1}'\right]\left(20\right)\right],\left["Output Field:",\mathrm{TextField}\left['\mathrm{B2}'\right]\left(20,'\mathrm{editable}'='\mathrm{false}'\right)\right],\left[\mathrm{Button}\left("Clear 1st Field",\mathrm{SetOption}\left('\mathrm{target}'='\mathrm{B1}','\mathrm{value}'=""\right)\right),\mathrm{Button}\left("Copy to 2nd Field",\mathrm{SetOption}\left('\mathrm{target}'='\mathrm{B2}',\mathrm{Argument}\left('\mathrm{B1}'\right)\right)\right),\mathrm{Button}\left("Return 2nd Field",\mathrm{Shutdown}\left(\left['\mathrm{B2}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet1}\right)$

This Maplet application uses the SetOption with the reference shortcut.

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet2}≔\mathrm{Maplet}\left(\left[\left[\mathrm{Label}\left('\mathrm{caption}'="Enter an expression"\right)\right],\left["Input Field:",\mathrm{TextField}\left['\mathrm{TF1}'\right]\left(20\right)\right],\left[\mathrm{Button}\left("Change Font",\mathrm{SetOption}\left('\mathrm{TF1}'\left('\mathrm{font}'\right)='\mathrm{F1}'\right)\right),\mathrm{Button}\left("Change Color",\mathrm{SetOption}\left('\mathrm{TF1}'\left('\mathrm{background}'\right)='\mathrm{red}'\right)\right),\mathrm{Button}\left("Exit",\mathrm{Shutdown}\left(\left['\mathrm{TF1}'\right]\right)\right)\right]\right],\mathrm{Font}\left[\mathrm{F1}\right]\left("courier",\mathrm{size}=14\right)\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet2}\right)$