DocumentTools[Components]
Slider
generate XML for a Slider Component
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Slider(rng, opts)
rng
-
(optional) range(realcons); range of position values, defaults to 0..100
opts
(optional) ; one or more keyword options as described below
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.
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.
with⁡DocumentTools:
with⁡DocumentTools:-Components:
with⁡DocumentTools:-Layout:
Executing the Slider command produces a function call.
S≔Slider⁡identity=Slider0
S≔_XML_EC-Slider⁡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=[255,255,255],fontcolor=[0,0,0],filled=true,visible=true,pixel-width=190,pixel-height=38
By using commands from the DocumentTools:-Layout package a nested function call can be produced which represents a worksheet.
xml≔Worksheet⁡Group⁡Input⁡Textfield⁡S:
That XML representation of a worksheet can be inserted directly.
InsertContent⁡xml:
codestring≔\ns := true;\n\nt := false;
codestring≔ s := true; t := false;
S≔Slider⁡0...9.0,identity=Slider0,tooltip=My example Slider,showlabels,position=4.1,vertical,action=codestring:
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.
lookup≔InsertContent⁡xml,output=table
lookup≔table⁡Slider0=Slider1
lookupSlider0
Slider1
GetProperty⁡lookupSlider0,value
4.1
The width and height of a Slider can be specified, in pixels.
S1≔Slider⁡identity=Slider0,showlabels:S2≔Slider⁡identity=Slider1,showlabels,width=300:InsertContent⁡Worksheet⁡Group⁡Input⁡Textfield⁡S1,Group⁡Input⁡Textfield⁡S2:
The fill color and the font color of a Slider can be specified.
S1≔Slider⁡identity=Slider0,showlabels,vertical,fillcolor=LightBlue,fontcolor=DarkBlue:S2≔Slider⁡identity=Slider1,showlabels,vertical,height=300,fillcolor=LightBlue,fontcolor=DarkRed:InsertContent⁡Worksheet⁡Table⁡width=200,widthmode=pixels,alignment=center,Column⁡,Row⁡Cell⁡Textfield⁡S1,S2,fillcolor=LightBlue:
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.
See Also
Component Code
Component Constructors
DocumentTools
Embedded Components
Layout Constructors
XMLTools
Download Help Document