Rotary Gauge Component - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

Rotary Gauge Component

Insert a rotary gauge in a Standard Maple worksheet or document.

 

Description

Image of the Components Palette Item

Image of an Inserted Rotary Gauge

Rotary Gauge Properties

Rotary Gauge Component Example

Description

• 

The rotary gauge component performs an action or a series of actions to communicate with other embedded components when adjusting the needle in the gauge, although assigning an action to a component is not required.  

• 

To perform an action when the needle is adjusted, click the rotary gauge, and then from the Rotary Gauge context panel, select Edit Value Changed Code to open the Code Editor dialog for the rotary gauge. 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 needle in the gauge. For more information, see the Rotary Gauge Component Example on this page.

• 

The rotary gauge component is customized by setting options in the RotaryGauge Properties. To view the Rotary Gauge context panel, select the rotary gauge. Actions are associated with components using routines in the DocumentTools package.

• 

The Name property is used to reference the rotary gauge when using the routines from the DocumentTools package.

• 

The Show Axis Label and Show Axis Tick Marks properties displays an axis label and axis tick marks on the rotary gauge respectively when selected.

• 

The Continuous Update on Drag property performs a continuous action on one or more components when selected. The Maple commands in the Edit Value Changed Code property must be programmed as such to perform this continuous action.

Image of the Components Palette Item

Image of an Inserted Rotary Gauge

Rotary Gauge Properties

• 

The following table describes the control and use of the rotary gauge 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

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

tooltip

x

x

string

type

x

 

string

upper

x

x

integer or floating-point number

value

x

x

integer or floating-point number

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 true, the thumb can be moved with the mouse. By default, the value is false.

  

lower 

  

The lower bound on the rotary gauge. By default, the value is 0.

  

majorTicks 

  

The interval between the major ticks on the rotary gauge. By default, the value is 20.

  

minorTicks 

  

The interval between the minor ticks on the rotary gauge. By default, the value is 10.

  

pixelHeight 

  

The height of the rotary gauge image in pixels. By default, the value is 128.

  

pixelWidth 

  

The width of the rotary gauge image in pixels. By default, the value is 128.

  

showLabels 

  

Indicates if range values are shown. By default, the value is true.

  

showTicks 

  

Indicates if tick marks are shown. By default, the value is true.

  

tooltip 

  

The text that appears when the user hovers the mouse over the component.

  

type 

  

The type of the component. This returns "RotaryGauge".

  

upper 

  

The upper bound on the rotary gauge. By default, the value is 100.

  

value 

  

The current position of the rotary gauge marker. By default, the value is 0.

  

visible 

  

Specifies if the rotary gauge is visible. By default, the value is true.

Rotary Gauge 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 position of a  Rotary Gauge component by moving Meter and Slider components.

To insert the components:

1. 

Type Time(h), Distance(km), and Velocity(km/h) on three separate lines.

2. 

Insert a Meter beside Time, a Slider beside Distance, and a Rotary Gauge beside Velocity using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.

To set up the range and action for the Meter:

1. 

Click the Meter component to display the context panel.

2. 

Set the following values in the Meter context panel:

• 

Value at Lowest Position=1

• 

Value at Highest Position=12

• 

Current Position=4

• 

Spacing of Major Tick Marks=2

• 

Spacing of Minor Tick Marks=1

• 

Select Enable Input

• 

Select Continuous Update on Drag

3. 

 Select Edit Value Changed Code.

This launches the Code Editor dialog.

4. 

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

t:=GetProperty("Meter0", value);

d:=GetProperty("Slider0", value);

v:=d/t;

SetProperty("RotaryGauge0", value, v);

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

5. 

Click  or from the File menu, select Save Code to accept all changes.

6. 

From the File menu, select Close Code Editor.

To change the appearance and action of the Slider:

1. 

Click on the Slider component to display the context panel.

2. 

Set the following values in the Slider context panel:

• 

Value at Highest Position=1500

• 

Current Position =200

• 

Spacing of Major Tick Marks=750

• 

Spacing of Minor Tick Marks=50

• 

Select Show Axis Labels

• 

Select Continuous Update on Drag

 

3. 

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

This launches the Code Editor dialog.

4. 

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

t:=GetProperty("Meter0", value);

d:=GetProperty("Slider0", value);

v:=d/t;

SetProperty("RotaryGauge0", value, v);

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

5. 

Click  or from the File menu, select Save Code to accept all changes.

6. 

From the File menu, select Close Code Editor.

To change the appearance of the Rotary Gauge:

1. 

Click on the Rotary Gauge component to open the context panel.

2. 

Set the following values in the RotaryGauge Properties dialog:

• 

Value at Highest Position=500

• 

Spacing of Major Tick Marks=100

• 

Spacing of Minor Tick Marks=50

• 

Select Continuous Update on Drag

 

Move the needles on the time or distance components and the Rotary Gauge representing velocity will respond.

 

 

 

 

Time(h)    

Distance(km)    

Velocity(km/h)    

 

with(DocumentTools):

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

t := GetProperty("Meter0", value);

d := GetProperty("Slider0", value);

v := d/t;

SetProperty("RotaryGauge0", value, v);

t5

d543

v5435

(5.1)

 

 

See Also

DocumentTools

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents