Check Box Component - Maple Help

Online Help

All Products    Maple    MapleSim

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

Check Box Component


The check box component defines a check box in a Standard Maple worksheet or document. This 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, right-click (Control-click for Macintosh) the check box, and then select Edit Click Action 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 CheckBox Properties. To open the CheckBox Properties, right-click (Control-click for Macintosh) the check box, and then select Component Properties. 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.  

Component Palette Image

Check Box Properties


The following table describes the control and use of the check box 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           
groupname        x  x  string                  
image               x  name or string          
imageSelected                       x  name or string          
pixelHeight      x  x  positive integer        
pixelWidth       x  x  positive integer        
tooltip          x  x  string                  
useSpecifiedSize x  x  true or false           
value            x  x  true or false           
visible          x  x  true or false           




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.




The name of the component group.




The image that appears on the check box when it is not checked.




The image that appears on the check box when it is checked.




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.




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.

Check Box Component Example

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.


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


In the Plot Expression field, enter plot(sin(x), x=0..10), and then click OK.

To display a caption on the Check Box component:


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


Change the Caption field to Display Title, and then click OK.

To show a title on the plot when the check box is selected:


Right-click (Control-click for Macintosh) on Display Title, 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.


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

if Do(%CheckBox0) then
    Do(%Plot0=plot(sin(x), x=0..10, title="Plot of Sine"));
    Do(%Plot0=plot(sin(x), x=0..10));
end if;
end proc:

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


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.

myProc := proc()
  if DocumentTools[Do](`%CheckBox0`) then
    DocumentTools[Do](`%Plot0` = plot(sin(x), x = 0..10, title = "Plot of Sine"));
    DocumentTools[Do](`%Plot0` = plot(sin(x), x = 0..10));
  end if:
end proc;

See Also

ButtonComponent, ComboBoxComponent, DataTableComponent, DialComponent, DocumentTools, DocumentTools[Do], DocumentTools[GetProperty], DocumentTools[SetProperty], EmbeddedComponents, LabelComponent, ListBoxComponent, MathExpressionComponent, MeterComponent, PlotComponent, RadioButtonComponent, 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