Argument - Maple Help

Maplets[Elements]

 Argument
 specify an argument for an Evaluate element

 Calling Sequence Argument(opts)

Parameters

 opts - equation(s) of the form source=value; specify options for the Argument element

Description

 • The Argument element specifies the argument of a Maple function call.
 • The Argument 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 source option

 • An Argument element cannot contain other elements.
 • An Argument element can be contained in an Evaluate or SetOption element.
 • The following table describes the control and use of the Argument 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 source* x quotedtext x value* x

 *Note that the source and value options are mutually exclusive (see below).
 • The opts argument can contain one or more of the following equations that set Maplet application options.
 source = reference to an element (name or string)
 A name or string referring to another element in the Maplet application. This option cannot be used in combination with value.
 quotedtext = indicates if argument is a text argument (for example, the contents of a TextField)
 By default, the value of this is false, in which case the argument must be a valid mathematical expression or value. When set to true, the argument is passed as a string.
 value = reference to a fixed value, to be passed as is
 An arbitrary Maple object, to be passed as the specified argument to the Evaluate procedure. Note that this option can only be used with certain forms of Evaluate and cannot be used with SetOption. This option cannot be used in combination with source.

Examples

 > f := proc(a)    int(a, x); end proc:
 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left[\left[\mathrm{TextField}\left['\mathrm{TF1}'\right]\left(\right)\right],\left[\mathrm{Button}\left['\mathrm{B1}'\right]\left("Integrate w.r.t. x",\mathrm{Evaluate}\left('\mathrm{target}'='\mathrm{TF1}','\mathrm{function}'="f",\mathrm{Argument}\left('\mathrm{TF1}'\right)\right)\right)\right],\left[\mathrm{Button}\left['\mathrm{B2}'\right]\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF1}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

This Maplet application can also be written as:

 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left[\left[\mathrm{TextField}\left['\mathrm{TF1}'\right]\left(\right)\right],\left[\mathrm{Button}\left['\mathrm{B1}'\right]\left("Integrate w.r.t. x",\mathrm{Evaluate}\left('\mathrm{TF1}'='f\left(\mathrm{TF1}\right)'\right)\right)\right],\left[\mathrm{Button}\left['\mathrm{B2}'\right]\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF1}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

The expression $f\left(\mathrm{TF1}\right)$ must be placed in unevaluation quotes. Otherwise, the function $f\left(\mathrm{TF1}\right)$ evaluates to $\mathrm{TF1}x$.

The same example, but using Argument with 'value':

 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left[\left[\mathrm{TextField}\left['\mathrm{TF1}'\right]\left(\right)\right],\left[\mathrm{Button}\left['\mathrm{B1}'\right]\left("Integrate w.r.t. x",\mathrm{Evaluate}\left('\mathrm{target}'='\mathrm{TF1}','\mathrm{function}'='\mathrm{diff}',\mathrm{Argument}\left('\mathrm{TF1}'\right),\mathrm{Argument}\left('\mathrm{value}'=x\right)\right)\right)\right],\left[\mathrm{Button}\left['\mathrm{B2}'\right]\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF1}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$

The following Maplet application counts the number of characters in a string input:

 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\left[\left[\mathrm{TextField}\left['\mathrm{TF1}'\right]\left("This is a test"\right)\right],\left[\mathrm{TextField}\left['\mathrm{TF2}'\right]\left("",\mathrm{editable}=\mathrm{false}\right)\right],\left[\mathrm{Button}\left['\mathrm{B1}'\right]\left("Count",'\mathrm{onclick}'=\mathrm{Evaluate}\left(\mathrm{target}='\mathrm{TF2}',\mathrm{function}='\mathrm{length}',\mathrm{Argument}\left('\mathrm{TF1}',\mathrm{quotedtext}=\mathrm{true}\right)\right)\right),\mathrm{Button}\left['\mathrm{B2}'\right]\left("OK",\mathrm{Shutdown}\left(\left['\mathrm{TF2}'\right]\right)\right)\right]\right]\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$