Radio Button Component - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Radio Button Component

insert a radio button in a 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, select the radio button, and then select Edit Click Code 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 Radio Button context panel. To view the Radio Button context panel, select the toggle button. 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 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

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

type

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.

  

type 

  

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

  

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. 

Click the Plot component, and then select Component Properties.

3. 

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

 

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

1. 

Click the first Radio Button component, and then select Component Properties.

2. 

In the Caption field, enter Constrained.

3. 

Select Edit Click Code.

This launches the Code Editor dialog.

4. 

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

SetProperty("Plot0", value, plot(x^2*cos(x), x=-Pi..Pi, scaling=constrained));

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

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 scaling of the plot to unconstrained by clicking on the second Radio Button:

1. 

Click the second Radio Button component to open the context panel.

2. 

In the Caption field, enter Unconstrained.

3. 

Select Edit Click Code to launch the Code Editor dialog.

4. 

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

SetProperty("Plot0", value, plot(x^2*cos(x), x=-Pi..Pi, scaling=unconstrained));
Note: Ensure the component name (that is, Plot0) is correct.

5. 

Click  or 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

DocumentTools

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents

Maplets[Elements][RadioButton]