Slider Component
insert a slider in a worksheet or document
Description
Component Palette Image
Slider Properties
Slider Component Example
The slider component performs an action or a series of actions to communicate with other embedded components when altering the slider position, although assigning an action to a component is not required.
To perform an action when the slider is altered select the slider, and then select Edit Value Changed Code to open the Code Editor dialog for the slider. Enter the commands you want to perform in the Code Editor dialog.
You need to specify one or more embedded components that will display the output when adjusting the slider. For more information, see the Slider Component Example on this page.
The Slider component is customized by setting options in the Slider context panel. To view the Slider context panel, select the slider. Sliders support floating-point values and spacing.
The Name property is used to reference the slider when using the routines from the DocumentTools package.
Actions are associated with components using routines in the DocumentTools package.
The following table describes the control and use of the Slider component options.
An x in the Get column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.
An x in the Set column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.
Option
Get
Set
Option Type
continuousupdate
x
true or false
enabled
fillcolor
color
fontcolor
filled
lower
integer or floating-point number
majorticks
positive integer or positive floating-point number
minorticks
pixelheight
positive integer
pixelwidth
showlabels
showticks
snaptoticks
tooltip
string
type
upper
value
vertical
visible
Indicates whether the component should update continuously during drag operations. By default, the value is false.
Whether the component is enabled. If enabled is set to false, the component is grayed out and any action associated with it cannot be initiated. By default, the value is true.
Specifies the background color of the component. The color can be given by RGB values (a list of three integers between 0 and 255) or a string representing a color name, for example, [255,0,0] or “Red”. The default value is [255,255,255] which corresponds to white.
Specifies the font color of the component. The default value is [0,0,0] which corresponds to black.
Indicates if the slider track is shown. By default, the value is true. Note: This option corresponds with the Show Track check box in the Slider Properties dialog.
The lower bound on the slider. By default, the value is 0.
The interval between the major ticks on the slider. By default, the value is 20.
The interval between the minor ticks on the slider. By default, the value is 10.
The vertical height of the slider. By default, the value is 38.
The horizontal width of the slider. By default, the value is 190.
Indicates if labels are shown. By default, the value is false.
Indicates if tick marks are shown. By default, the value is true.
Indicates if the slider must be snapped to tick marks. By default, the value is false.
The text that appears when the user hovers the mouse over the component.
The type of the component. This returns "Slider".
The upper bound on the slider. By default, the value is 100.
The current position of the slider marker. By default, the value is 10.
Specifies orientation of the slider. By default, the value is false.
Specifies if the slider is visible. By default, the value is true.
Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.
This example alters the plot of sin⁡x⁢ⅇy by changing a slider position using embedded components.
To insert the components and configure the plot component:
Insert a Plot and Slider component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.
Click the Plot component to display the Plot context panel.
In the Plot Expression region, enter: plot3d(sin(x)*exp(y), x=0..5, y=-1..1);
To configure the slider component:
Click the Slider component to display the context panel.
Change the Value at Lowest Position to 5.
Change the Value at Highest Position to 25.
Change the Current Position to 5.
Change the Spacing of Major Tick Marks to 5.
Change the Spacing of Minor Tick Marks to 1.
Select Show Axis Labels.
To alter the plot's x-range by changing the slider position:
Click the Slider component, and then select Edit Value Changed Code.
This launches the Code Editor dialog.
Before the end use; statement in the dialog, enter the following command:
SetProperty("Plot0", value, plot3d(sin(x)*exp(y), x=0..GetProperty("Slider0", value), y=-1..1));
Note: Ensure the names of the components are correct (that is, that they match the Name fields for their components).
Click or from the File menu, select Save Code to accept all changes.
From the File menu, select Close Code Editor.
Changing the position of the slider changes the x-range for the 3-D plot.
with(DocumentTools):
You can verify the syntax of the embedded component action by executing the command in the worksheet.
See Also
DocumentTools
DocumentTools[GetProperty]
DocumentTools[SetProperty]
EmbeddedComponents
Maplets[Elements][Slider]
Download Help Document