Check Box Component - Maple Programming 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

See Also

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, 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.  

Component Palette Image

Check Box Properties

• 

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

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

type

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 selected.

  

imageSelected 

  

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

  

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.

  

type 

  

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

  

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. 

Click the Plot component to display the Plot context panel.

3. 

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

To display a caption on the Check Box component:

1. 

Click the Check Box component to display the Check Box context panel.

2. 

Change the Caption field to Display Title.

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

1. 

Click Display Title, and then select Edit Click Code.

This launches the Code Editor dialog.

2. 

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

3. 

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

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]