Slider Component - Maple Help

Slider Component

Insert a slider in a Standard Maple worksheet or document.

Description

 • 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.
 Component Palette Image

Slider Properties

 • 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 x true or false enabled x x true or false fillcolor x x color fontcolor x x color filled x x true or false lower x x integer or floating-point number majorTicks x x positive integer or positive floating-point number minorTicks x x positive integer or positive floating-point number pixelHeight x x positive integer pixelWidth x x positive integer showLabels x x true or false showTicks x x true or false snapToTicks x x true or false tooltip x x string type x string upper x x integer or floating-point number value x x integer or floating-point number vertical x x true or false visible x x true or false

 continuousupdate
 Indicates whether the component should update continuously during drag operations. By default, the value is false.
 enabled
 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.
 fillcolor
 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.
 fontcolor
 Specifies the font color of the component.  The default value is [0,0,0] which corresponds to black.
 filled
 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.
 lower
 The lower bound on the slider. By default, the value is 0.
 majorTicks
 The interval between the major ticks on the slider. By default, the value is 20.
 minorTicks
 The interval between the minor ticks on the slider. By default, the value is 10.
 pixelHeight
 The vertical height of the slider. By default, the value is 38.
 pixelWidth
 The horizontal width of the slider. By default, the value is 190.
 showLabels
 Indicates if labels are shown. By default, the value is false.
 showTicks
 Indicates if tick marks are shown. By default, the value is true.
 snapToTicks
 Indicates if the slider must be snapped to tick marks. By default, the value is false.
 tooltip
 The text that appears when the user hovers the mouse over the component.
 type
 The type of the component. This returns "Slider".
 upper
 The upper bound on the slider. By default, the value is 100.
 value
 The current position of the slider marker. By default, the value is 10.
 vertical
 Specifies orientation of the slider. By default, the value is false.
 visible
 Specifies if the slider is visible. By default, the value is true.

Slider Component Example

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 $\mathrm{sin}\left(x\right){ⅇ}^{y}$ by changing a slider position using embedded components.

To insert the components and configure the plot component:

 1 Insert a Plot and Slider component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.
 2 Click the Plot component to display the Plot context panel.
 3 In the Plot Expression region, enter: plot3d(sin(x)*exp(y), x=0..5, y=-1..1);

To configure the slider component:

 1 Click the Slider component to display the context panel.
 2 Change the Value at Lowest Position to 5.
 3 Change the Value at Highest Position to 25.
 4 Change the Current Position to 5.
 5 Change the Spacing of Major Tick Marks to 5.
 6 Change the Spacing of Minor Tick Marks to 1.
 7 Select Show Axis Labels.

To alter the plot's x-range by changing the slider position:

 1 Click the Slider component, and then select Edit Value Changed Code.

This launches the Code Editor dialog.

 2 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).

 3 Click  or from the File menu, select Save Code to accept all changes.
 4 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.

 > SetProperty("Plot0", value, plot3d(sin(x)*exp(y), x=0..GetProperty("Slider0", value), y=-1..1));