Check Box Component
insert a check box in a Standard Maple worksheet or document
Description
Component Palette Image
Check Box Properties
Check Box Component Example
The check box component performs an action or a series of actions to communicate with other embedded components when the check box is selected, although assigning an action to a component is not required. The check box component can display a caption or an image.
To perform an action when a check box is selected, click the check box to display the Check Box context panel. Select Edit Click Code to open the Code Editor dialog for the check box. 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 check box selection. For more information, see the Check Box Component Example on this page.
The check box component is customized by setting options in the Check Box context panel. To display the Check Box context panel, click the check box. Actions are associated with components using routines in the DocumentTools package.
The Name property is used to reference the check box when using the routines from the DocumentTools package.
The Group Name property is used to automatically group components of the same name. When a component is grouped, it acts as a radio button where 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: Radio Button Component and Toggle Button Component.
The following table describes the control and use of the check box 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
string
enabled
true or false
fillcolor
color
fontcolor
groupname
image
name or string
imageselected
pixelheight
positive integer
pixelwidth
tooltip
type
usespecifiedsize
value
visible
The caption that appears on the component. By default, the value is CheckBox.
Whether the component is enabled. If enabled is set to false, the button is grayed out and any action associated with it cannot be initiated. By default, the value is true.
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.
Specifies the font color of the component. The default value is [0,0,0] which corresponds to black.
The name of the component group.
The image that appears on the check box when it is not selected.
The image that appears on the check box when it is selected.
The height of the image in pixels.
The width of the image in pixels.
The text that appears when the user hovers the mouse over the component.
The type of the component. This returns "CheckBox".
Whether the specified size of the image is used. By default, the value is false.
Specifies if the check box is selected. By default, the value is false.
Specifies if the check box is visible. By default, the value is true.
Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.
This example uses a Plot component to display a plot of sin(x) and a Check Box component to optionally display the plot title.
To insert the components and display the plot of sin(x):
Insert a Plot and Check Box component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.
Click the Plot component to display the Plot context panel.
In the Plot Expression field, enter plot(sin(x), x=0..10).
To display a caption on the Check Box component:
Click the Check Box component to display the Check Box context panel.
Change the Caption field to Display Title.
To show a title on the plot when the check box is selected:
Click Display Title, and then select Edit Click Code.
This launches the Code Editor dialog.
Before the end use; statement in the dialog, enter the following commands:
myProc:=proc() if GetProperty("CheckBox0",value) = "true" then SetProperty("Plot0",value,plot(sin(x), x=0..10, title="Plot of Sine")); else SetProperty("Plot0",value,plot(sin(x), x=0..10)); end if; end proc: myProc();
Note: Ensure the names of the components are correct (that is, that they match the Name fields for their components).
Click or, from the File menu, select Save Code to accept all changes.
From the File menu, select Close Code Editor.
When you select Display Title, the title displays above the plot.
You can verify the syntax of the embedded component action by executing the command in the worksheet.
with(DocumentTools):
myProc := proc() if GetProperty("CheckBox0",value) = "true" then SetProperty("Plot0",value,plot(sin(x), x = 0..10, title = "Plot of Sine")); else SetProperty("Plot0",value,plot(sin(x), x = 0..10)); end if: end proc:
myProc():
See Also
DocumentTools
DocumentTools[GetProperty]
DocumentTools[SetProperty]
EmbeddedComponents
Maplets[Elements][CheckBox]
Download Help Document