Slider Component - Maple Help

DocumentTools[Components]

 Slider
 generate XML for a Slider Component

 Calling Sequence Slider(rng, opts)

Parameters

 rng - (optional) range(realcons); range of position values, defaults to 0..100 opts - (optional) ; one or more keyword options as described below

Options

 • action : string; A string which parses to one or more valid statements in 1-D Maple notation. These statements form the Value Changed Action Component Code that executes when the Slider position is manually adjusted.
 • continuous : truefalse; Indicates whether dragging of the sliding component will result in continuous updates using the action code.
 • enabled : truefalse; Indicates whether the component is enabled. The default is true. If enabled is false, then the inserted sliding component is grayed out and interaction with it cannot be initiated.
 • fillcolor : {list(nonnegint),symbol,string}:=[255,255,255] ; Specifies the background color of the component. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [255,255,255] which corresponds to white.
 • fontcolor : {list(nonnegint),symbol,string}:=[0,0,0] ; Specifies the font color of the component. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [0,0,0] which corresponds to black.
 • height : posint:=38 ; The height in pixels of the component.
 • identity : {name,string}; The reference name of the component.
 • majorticks : numeric; The interval between the major tickmarks on the sliding component. The default is .2 times the upper value of rng minus the lower value of rng.
 • minorticks : numeric; The interval between the minor tickmarks on the sliding component. The default is 1/2 majorticks.
 • position : numeric; The initial position of the sliding component. If not specified the value of the left end-point of the rng argument is used.
 • showlabels : truefalse; Indicates whether values are shown beside tickmarks. The default is true.
 • showticks : truefalse; Indicates whether tickmarks are shown. The default is true.
 • showtrack : truefalse; Indicates whether the sliding component's track is shown. The default value is true.
 • snaptoticks : truefalse; Indicates whether the sliding component will only take on values at major tickmarks. The default is false.
 • tooltip : string; The text that appears when the mouse pointer hovers over the component.
 • vertical : truefalse; Indicates whether the sliding component is oriented vertically. The default is false, with horizontal orientation.
 • visible : truefalse; Indicates whether the component is visible. The default is true.
 • width : posint:=190 ; The width in pixels of the component.

Description

 • The Slider command in the Component Constructors package returns an XML function call which represents a Slider Component.
 • The generated XML can be used with the results of commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document can be inserted into the current document using the InsertContent command.

Examples

 > $\mathrm{with}\left(\mathrm{DocumentTools}\right):$
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Components}\right):$
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Layout}\right):$

Executing the Slider command produces a function call.

 > $S≔\mathrm{Slider}\left(\mathrm{identity}="Slider0"\right)$
 ${S}{≔}{\mathrm{_XML_EC-Slider}}{}\left({"id"}{=}{"Slider0"}{,}{"lower-bound"}{=}{"0"}{,}{"upper-bound"}{=}{"100"}{,}{"control-position"}{=}{"0"}{,}{"major-tick-spacing"}{=}{"20"}{,}{"minor-ticks"}{=}{"10"}{,}{"orientation"}{=}{"false"}{,}{"show-labels"}{=}{"false"}{,}{"show-ticks"}{=}{"true"}{,}{"snap-to-ticks"}{=}{"false"}{,}{"continuous-update"}{=}{"false"}{,}{"inputenabled"}{=}{"true"}{,}{"fillcolor"}{=}{"\left[255,255,255\right]"}{,}{"fontcolor"}{=}{"\left[0,0,0\right]"}{,}{"filled"}{=}{"true"}{,}{"visible"}{=}{"true"}{,}{"pixel-width"}{=}{"190"}{,}{"pixel-height"}{=}{"38"}\right)$ (1)

By using commands from the DocumentTools:-Layout package a nested function call can be produced which represents a worksheet.

 > $\mathrm{xml}≔\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(S\right)\right)\right)\right):$

That XML representation of a worksheet can be inserted directly.

 > $\mathrm{InsertContent}\left(\mathrm{xml}\right):$

 > $\mathrm{codestring}≔"\ns := true;\n\nt := false;"$
 ${\mathrm{codestring}}{≔}{"s := true; t := false;"}$ (2)
 > $S≔\mathrm{Slider}\left(0...9.0,\mathrm{identity}="Slider0",\mathrm{tooltip}="My example Slider",\mathrm{showlabels},\mathrm{position}=4.1,\mathrm{vertical},\mathrm{action}=\mathrm{codestring}\right):$
 > $\mathrm{xml}≔\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(S\right)\right)\right)\right):$

The previous example's call to the InsertContent command inserted a component with identity "Slider0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "Slider0" incurs a substitution of the input identity in order to avoid a conflict with the identity of the existing component.

The return value of the following call to InsertContent is a table which can be used to reference the substituted identity of the inserted component.

 > $\mathrm{lookup}≔\mathrm{InsertContent}\left(\mathrm{xml},\mathrm{output}=\mathrm{table}\right)$
 ${\mathrm{lookup}}{≔}{table}{}\left(\left[{"Slider0"}{=}{"Slider1"}\right]\right)$ (3)

 > $\mathrm{lookup}\left["Slider0"\right]$
 ${"Slider1"}$ (4)
 > $\mathrm{GetProperty}\left(\mathrm{lookup}\left["Slider0"\right],\mathrm{value}\right)$
 ${4.1}$ (5)

The width and height of a Slider can be specified, in pixels.

 > $\mathrm{S1}≔\mathrm{Slider}\left(\mathrm{identity}="Slider0",\mathrm{showlabels}\right):$$\mathrm{S2}≔\mathrm{Slider}\left(\mathrm{identity}="Slider1",\mathrm{showlabels},\mathrm{width}=300\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(\mathrm{S1}\right)\right)\right),\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(\mathrm{S2}\right)\right)\right)\right)\right):$

The fill color and the font color of a Slider can be specified.

 > $\mathrm{S1}≔\mathrm{Slider}\left(\mathrm{identity}="Slider0",\mathrm{showlabels},\mathrm{vertical},\mathrm{fillcolor}="LightBlue",\mathrm{fontcolor}="DarkBlue"\right):$$\mathrm{S2}≔\mathrm{Slider}\left(\mathrm{identity}="Slider1",\mathrm{showlabels},\mathrm{vertical},\mathrm{height}=300,\mathrm{fillcolor}="LightBlue",\mathrm{fontcolor}="DarkRed"\right):$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Table}\left(\mathrm{width}=200,\mathrm{widthmode}=\mathrm{pixels},\mathrm{alignment}=\mathrm{center},\mathrm{Column}\left(\right),\mathrm{Row}\left(\mathrm{Cell}\left(\mathrm{Textfield}\left(\mathrm{S1},\mathrm{S2}\right),\mathrm{fillcolor}="LightBlue"\right)\right)\right)\right)\right):

Compatibility

 • The DocumentTools:-Components:-Slider command was introduced in Maple 2015.
 • For more information on Maple 2015 changes, see Updates in Maple 2015.
 • The DocumentTools:-Components:-Slider command was updated in Maple 2016.
 • The fillcolor and fontcolor options were introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.