Radio Button Component - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

Radio Button Component

Insert a radio button in a Standard Maple worksheet or document.

 

Description

Component Palette Image

Radio Button Properties

Radio Button Component Example

Description

• 

The radio button component performs an action or a series of actions to communicate with other embedded components when the radio button is selected, although assigning an action to a component is not required.  

• 

To perform an action when a radio button is selected, right-click (Control-click for Macintosh) the radio button, and then select Edit Click Action to open the Code Editor dialog for the radio button. 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 of the radio button selection. For more information, see the Radio Button Component Example on this page.

• 

The radio button component is customized by setting options in the RadioButton Properties. To open the RadioButton Properties, right-click (Control-click for Macintosh) the toggle button, and then select Component Properties. Actions are associated with components using routines in the DocumentTools package.

• 

The Name property is used to reference the radio button when using the routines from the DocumentTools package.

• 

The Group Name property is used to automatically group components of the same name.  The default group name for the radio button component is Group0.  When a component is grouped, all components of the same group name will automatically be de-selected when one is selected.  Only the Maple code attached to the selected component of the group will be executed.  The following components can be added to a group: Check Box Component  and Toggle Button Component.

• 

You can de-select a radio button by clicking another radio button in the same group, in the same Maple worksheet. You can also select another radio button programmatically by specifying the command DocumentTools[SetProperty](<radio_button_name>,value,true).

Component Palette Image

Radio Button Properties

• 

The following table describes the control and use of the radio button 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    
                               
caption    x  x  string         
enabled    x  x  true or false  
fillcolor  x  x  color          

fontcolor  x  x  color          

groupname  x  x  string         
tooltip    x  x  string         
value      x  x  true or false  
visible    x  x  true or false  
                              

  

caption 

  

The caption that appears on the component.

  

enabled 

  

Whether the component is enabled. If enabled is set to false, the radio button 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.

  

groupname 

  

The name of the component group.

  

tooltip 

  

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

  

value 

  

Specifies if the radio button is selected. By default, the value is false.

  

visible 

  

Specifies if the radio button is visible. By default, the value is true.

Radio Button Component Example

Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.

This example shows how to apply scaling to a plot using a Plot embedded component and two radio buttons.

To insert the components and configure the Plot:

1. 

Insert a Plot component and two Radio Button components using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.

2. 

Right-click the Plot component, and then select Component Properties.

3. 

In the Plot Expression field, enter plot(x^2*cos(x), x=-Pi..Pi);.

4. 

Click OK.

To change the scaling of the plot to constrained by clicking on the first Radio Button:

1. 

Right-click the first Radio Button component, and then select Component Properties.

2. 

In the Caption field, enter Constrained, and then click OK.

3. 

Right-click (Control-click for Macintosh) on Constrained, and then select Edit Click Action.

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

4. 

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

Do(%Plot0=plot(x^2*cos(x), x=-Pi..Pi, scaling=constrained));

Note: Ensure the component name (that is, Plot0) is correct.

5. 

From the File menu, select Save Code to accept all changes.

6. 

From the File menu, select Close Code Editor.

To change the scaling of the plot to unconstrained by clicking on the second Radio Button:

1. 

Right-click the second Radio Button component, and then select Component Properties.

2. 

In the Caption field, enter Unconstrained, and then click OK.

3. 

Right-click (Control-click for Macintosh) on Unconstrained, and then select Edit Click Action.

4. 

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

Do(%Plot0=plot(x^2*cos(x), x=-Pi..Pi, scaling=unconstrained));

Note: Ensure the component name (that is, Plot0) is correct.

5. 

From the File menu, select Save Code to accept all changes.

6. 

From the File menu, select Close Code Editor.

Selecting the appropriate radio button changes the scaling of the plot to either constrained or unconstrained. Note that radio buttons were both in the same default group when they were inserted; this ensures that only one radio button can be selected at a time.

 

See Also

ButtonComponent

CheckBoxComponent

ComboBoxComponent

DataTableComponent

DialComponent

DocumentTools

DocumentTools[Do]

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents

LabelComponent

ListBoxComponent

Maplets[Elements][RadioButton]

MathExpressionComponent

MeterComponent

PlotComponent

RotaryGaugeComponent

SliderComponent

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