Check Box Component - Maple Help

Online Help

All Products    Maple    MapleSim


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

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

Description

• 

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, 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           
fillcolor        x  x  color                   
fontcolor        x  x  color                   
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           
                                                

  

caption 

  

The caption that appears on the component.  By default, the value is CheckBox.

  

enabled 

  

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.

  

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.

  

image 

  

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

  

imageSelected 

  

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

  

pixelHeight 

  

The height of the image in pixels.

  

pixelWidth 

  

The width of the image in pixels.

  

tooltip 

  

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

  

useSpecifiedSize 

  

Whether the specified size of the image is used. By default, the value is false.

  

value 

  

Specifies if the check box is selected. By default, the value is false.

  

visible 

  

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):

1. 

Insert a Plot and Check Box component 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 > Component Properties.

3. 

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:

1. 

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

2. 

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

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

1. 

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.

2. 

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

myProc:=proc()
if Do(%CheckBox0) then
    Do(%Plot0=plot(sin(x), x=0..10, title="Plot of Sine"));
else
    Do(%Plot0=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).

3. 

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

4. 

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"));
  else
    DocumentTools[Do](`%Plot0` = plot(sin(x), x = 0..10));
  end if:
end proc;
myProc():

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