Slider Component - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Document Tools : Embedded Components : SliderComponent

Slider Component

Insert a slider in a Standard Maple worksheet or document.

 

Description

Component Palette Image

Slider Properties

Slider Component Example

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, right-click (Control-click for Macintosh) the slider, and then select Edit Value Changed Action 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 Properties. To open the Slider Properties, right-click (Control-click for Macintosh) the slider, and then select Component Properties. 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 G column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.

  

An x in the S column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.

Option           G  S  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                                            
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.

  

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 sinxⅇ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. 

Right-click (Control-click for Macintosh) the Plot component, and then select Component > Component Properties.

3. 

In the Plot Expression region, enter plot3d(sin(x)*exp(y), x=0..5, y=-1..1).

4. 

Click OK.

To configure the slider component:

1. 

Right-click (Control-click for Macintosh) the Slider component, and then select Component Properties.

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.

8. 

Click OK.

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

1. 

Right-click (Control-click for Macintosh) the Slider component, and then select Edit Value Changed Action.

This launches a dialog with preset statements and additional information on how to program actions between embedded components.

2. 

Before the end use; statement in the dialog, enter the following command:

Do( %Plot0=plot3d(sin(x)*exp(y), x=0..%Slider0, y=-1..1));

Note: Ensure the names of the components are correct (that is, that they match the Name fields for their components).

3. 

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.

  

 

You can verify the syntax of the embedded component action by executing the command in the worksheet.

DocumentTools[Do](%Plot0 = plot3d(sin(x)*exp(y), x = 0..%Slider0, y=-1..1));

See Also

ButtonComponent

CheckBoxComponent

ComboBoxComponent

DataTableComponent

DialComponent

DocumentTools

DocumentTools[Do]

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents

LabelComponent

ListBoxComponent

MathExpressionComponent

MeterComponent

PlotComponent

RadioButtonComponent

RotaryGaugeComponent

TextAreaComponent

ToggleButtonComponent

VideoPlayerComponent

VolumeGaugeComponent

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam